When you are working to develop a website / blog, you sometimes need to think about the image formats you use, because this could help for saving a lot of bandwidth costs, by making the right choose.
On the web today there are 3 main image format types to choose from and all have their advantages and disadvantages, minuses and pluses. You have a choice of three different compressed image formats: GIF, JPEG or PNG. They each use different techniques to compress the image information.
GIF
GIF uses a lossless compression method which means that no quality is lost in the compression.
The uncompressed image stores its information in a linear fashion. Each line of pixels is read from left to right. An interlaced GIF image file stores the lines of the image in a different order. First lines 4, 8, 12, 16 and 20 may be read in. Then lines 2, 6, 10, 14, and 18 and so on until the whole image is recognized. With this type of interlaced GIF file, when a internet user with a slower internet connection tries to open the image file, he is able to read the image while this is loading.
The GIF format achieves its compression by removing repeated patterns within the GIF image file and keeping references to these sections in a list. Images with horizontal lines of the same color or pattern benefit most from the GIF format. A few examples are backgrunds, images containing text and other patterned images.
Creating animated images are another great advantage when using GIF. They are used in a vary numerous numbers on the internet, so you cannot noticed them. An animated GIF is basically a sequence of GIF files with some timing information included. But usually, animated GIFs can achieve large amount of size very quickly, with only a few number of frames. So, it’s better to use Macromedia Flash if you want to make animated files, instead of animated GIFs.
Another big advantage to GIF files is transparency. A color within the color table can be selected as the transparent color.
Unfortanatelly, one of the largest minuses to the GIF file format is the inability to have a color palette larger than 256 colors.
JPEG
JPEG image format uses a lossy compression. This means that image quality is lost in the process of compressing the image. JPEG compression works by converting the image from RGB to YUV which stores information about each pixel using 3 parameters. Those 3 are : brightness, hue and saturation. Then it reduces the amount of information it stores for hue and saturation since differences are less noticeable to the human eye. JPG is best used for images that have more of a variation in colors. For example, images with gradients or photographs can handle a lower quality setting with little noticeable loss in quality. Images with text or large solid backgrounds are best left for GIF or PNG.
PNG
PNG image file format is a pretty new format in the list of available image formats and it is a “great to use” one. Its functions are almost similar to GIF advantages in many ways but even better in others. It is lossless like GIF format but supports 24 bit color (GIF supports only 8).
PNG supports alpha transparency, while GIF image format supports only a single color transparency. PNG uses various compression filters to minimize overall image size and can apply different filters on a per-line basis to achieve higher compression.
The big attraction to PNGs is its ability to do alpha transparency.
If you are not using alpha transparency or do not need more than 256 colors then you can export your imagefile as an 8-bit PNG. This could lead to a smaller in file size than GIF with absolutely no difference in image quality. If you do not need alpha transparency but wish to use a color palette greater than 256 colors then you should use a 24-bit PNG.
So… is there a winner?
No image file format is best in all scenarios, and no image file format have all the advantages. So, it’s always recommended to know what you want to achieve with your file, and always test your options , using various formats and compression levels to achieve the best results.
If you want to learn more on the history or other and deeper explanations of these image formats, read about GIF , JPEG , and PNG on Wikipedia, and also read about image formats, here in this post.
If you found this post interesting, buy me a coffee. Thank You.
Recent Comments