|
|||
Department of Engineering | |
University of Cambridge > Engineering Department > computing help |
The GIF image format uses lossless image compression in order to decrease the file size in a way which preserves image information. The Lossless compression technique that GIF uses is unable to compress images better than about 5:1 (e.g. a 640x480 8 bit image compressed to 60Kb).
JPEG uses lossy compression techniques and allows control over the degree of `lossy-ness.' Lossy compression causes loss of image information. For JPEG, this usually means that the image becomes blurred. The degree of blurring is controlled by the quality factor which is normally in the range 50% to 95%. This is an arbitrary measure of how much frequency domain information is preserved and 75% is considered adequate for most images. Compression ratios of 30:1 to 50:1 are not unusual for JPEG although increasing compression corresponds to increasing image defects.
It is important to remember that JPEG compression works well with natural images and badly with cartoon images. This is because the absence of sharp edges in the former tends to hide the effect of moderate JPEG compression.
Original GIF image : size 47935 bytes (1.3:1)
JPEG image; Q factor 75% : size 11502 bytes (5.6:1)
JPEG image; Q factor 25% : size 5590 bytes (11.4:1)
Here are the effects of JPEG compressing a line drawing type image - notice how JPEG compression actually leads to an increase in file size in this case:
Part of original GIF image : size 3302 bytes (19.4:1)
JPEG image; Q factor 75% : size 12977 bytes (4.9:1)
tw100/jbloggs: giftoppm your.gif | cjpeg -quality 75 > your.jpg
| computing help | |