This article quoted: https://www.cnblogs.com/changyangzhe/articles/5718285.html
GIF introduction
gif means Graphics Interchange Format (Graphics Interchange), and GIF images have a gif extension. All graphics browsers now support GIF format, and some graphics browsers are only familiar with GIF format. GIF is an indexed color format, in the case of a small number of colors, the resulting file is very small, its advantages are mainly:1. The GIF format supports background transparency. 2. GIF format supports animations. 3. GIF format supports graphics progressive. 4. Lossless compression is supported in the GIF format. 5. Horizontal scan. Cons: GIF The biggest disadvantage of indexed color format is that it has only 256 colors, which is obviously not enough for picture quality pictures.
JPG Introduction
JPEG represents joint Photograhic Experts Group (Joint Photographic Experts Group), which is often written as a jpg,jpg image with the extension jpg. The main advantage of JPG is the ability to support millions of colors, which can be used to represent photos. In addition, because JPG images use a more efficient lossy compression algorithm, the file length is smaller and the download time is shorter. lossy compression discards some of the details in the image to reduce the file length. Its compression ratio is quite high, using a dedicated JPG compression tool with a compression ratio of up to1, and image quality from the view point of view, the quality will not be too large.
This greatly facilitates network transmission and disk exchange files. JPG is more suitable for a photo than a GIF because losing some detail in a photo is not as obvious as an art line. In addition, JPG compresses photos more, and the final quality is better. Cons: But in the long run, with the increasing bandwidth and the development of storage media, JPG should also be an obsolete image format, because lossy compression can cause unrecoverable loss to the image. So compressed JPG pictures are generally not suitable for printing, it is best not to use JPG when backing up important pictures. Also, JPG is less flexible than GIF images, it does not support graphics progression, background transparency, or animation.
PNG introduction
PNG is an image file storage format that was developed in the mid 1990s to attempt to replace GIF and TIFF file formats while adding features not available in the GIF file format. The streaming web graphics format (Portable Network Graphic format,png) is named after the unofficial "PNG's notGIF", which is a bitmap (bitmap file) storage format that reads " Ping ". When PNG is used to store grayscale images, the depth of the grayscale image can be as much as 16 bits, and when the color image is stored, the depth of the color image can be as many as 48 bits, and the alpha channel data of up to 16 bits can also be stored. PNG uses a lossless data compression algorithm derived from LZ77.
Three image format applications
There are pros and cons to each of these three formats, with a lot of PNG benefits. Although the popularity is still very general, but its extraordinary superiority has let us have a very big hobby. At least I like this format very much now. Of course, for the production page of the production staff, the total size of the page volume that is competitiveness. So we still need to pay attention to these three kinds of formats of mixed use. When to use GIF when to use PNG when to use JPG? We hit analysis below. In the actual work, I found that the general color of the graphic, such as some small icons, tiled background with less color, then as the GIF format, although there are only 256 colors, but to deal with this type of picture that must be very appropriate. Of course, do not rule out some extraordinary small icon color richness, but I believe that as a small icon of its color a little loss will not affect the overall visual effect, so the scope of the GIF is: small icons, tiled backgrounds and other small color smaller pictures. Then how to choose the big picture, first we understand the JPG, we use Photoshop friends know that in the final export of the picture will have a place to let us choose the image quality of this JPG image,The percentageis no compression, When we take the same picture to export different quality picture comparison we found that the quality of the low is obviously higher than the quality of the dirty a lot, so the picture looks very bad, of course, we also found that this situation in the large color block of the picture is still prominent. So like the sky and the portrait. Unusual faces can have dark spots that are hard to see. Of course, if the quality requirements for the photo is not strict, you can use JPG and reduce quality. But not for backgrounds, small icons.
Finally: Introduction to the WEBP format
WEBP format:
A graphic format developed by Google to speed up the loading of pictures. Image compression volume is only about 2/3of JPEG, and can save a lot of server bandwidth resources and data space. Well-known websites like Facebook and ebay have started testing and using the WEBP format. Of course, it is also a lossy compression, its main purpose is to speed up the network image transmission efficiency, so that the picture can be displayed faster in the eyes of users. Only the higher version of the Web browser is known to support this format, such as Chorme39+,safari7+ and so on.
Image format: GIF/PNG/PG/WEBP introduction