Image Formats: A Comparison
Below is a comparison of JPEG and Gif compression a continuous tone (photographic) image and a flat-color image.
Left: JPEG high quality (5.2k). Right: gif 256 colors (15.8k).
Left: JPEG low (1.6K). Right: gif 16 colors (5.0k).
Check the differences in image quality and image size. With the continuous tone image above, JPEG beats Gif every time. The images look better, and weigh in at less.
Left: JPEG high (3.6k). Right: gif 256 colors (1.5k)
Left: JPEG low (1.8K). Right: gif 16 colors (1.5k)
Looking at this set of flat-color images, the Gif wins. Even the higher setting on JPEG shows artifacts (look at the left edge of the red square in the second from bottom row), and it’s twice the file size.
The New(ish) Format: PNG
As something of a response to GIF, it being proprietary, the PNG, or Portable Network Graphic was developed. Here’s a quote from their site:
PNG works. That 5-25% mentioned in the quote above is enough for me. Here’s a couple of comparisons:
Left: GIF, 438 bytes. Right: PNG, 239 bytes. The PNG size is 54% of the GIF.
Left: GIF, 1.412K. Right: PNG, 265 bytes. Here the GIF is over 5 × larger.
Notice also how PNG handles the vertical stripes better than GIF. GIF compression works in a linear, horizontal fashion, so the same stripes rotated from horizontal to vertical increase the GIF size over three-fold. With the PNG, the increase is slight, around 10%.
These are just simple comparisons, but they do point out a very important point when imaging for the web. You need to try different methods of compression, and at different settings. Often you can save lots of size, which translates to download time. And always remember that with the web, you only need as good as you need. Good enough is good enough.
