So which one should we choose as the candidate format for GIF, PNG, and JPG format, and which image format can make the picture smaller but have better picture quality?
1. Image format GIFThe most prominent feature of GIF is that it supports animation, and GIF is also a lossless image format, which means that after you modify the image, the image quality will not be lost. Furthermore, GIF supports translucent (full transparent or full opaque).
According to Google, GIF is suitable for small or simple pictures (10×10 or below or below 3 colors).
PNGFirst of all, PNG includes PNG-8 and true color-PNG (PNG-24 or PNG-32). The biggest advantage of PNG over GIF is:
But we know that PNG does not support animation.
At the same time, it should be noted that IE6 can support PNG-8, but it will display gray when dealing with the transparency of PNG-24. For related examples, please refer to sitepoint.
Usually, saving the image as PNG-8 will result in smaller volumes than GIFs under the same quality, while we can only use PNG-24 for fully transparent images. But please note that saving the image is compared in PNG-8 and GIFs. Because the law is not always correct.
JPGJPG can display more colors than GIF and PNG, and it gets very compressed, so JPG is very suitable for saving digital photos. But be aware that it is a kind of distortion compression, which means that every time you modify the picture, you will cause pixel distortion.
After reading the above introduction, you should have a rough understanding of which format to save which picture. Simply put, it is:
In a word: For a small picture or web page basic elements (such as buttons), consider PNG-8 or GIF. For photos, consider JPG.