One of the main tasks facing the layout of new sites is the quick loading of pages by browsers. And since far from all users like the minimalistic design, you have to find a compromise between beautiful design with elegant graphic elements and the speed of the web resource. Previously, in order to reduce the weight of images, website developers used either GIF or JPG. Now more and more typesetters are using PNG images. Let's try to figure out why this happens together.
Why was the PNG format invented?
The abbreviation, which is the name of this type of graphics, is formed from the first letters of the following English words: portable network graphics, which can be translated as "roaming graphics for use on the network." The PNG format was specially invented in order to eliminate compression flaws using the simpler GIF algorithm, which is slowly starting to become obsolete. In addition, it can be used to some extent to replace the much bulky TIFF, used mainly for editing.
What is the PNG format?
To date, two versions of this algorithm are widely used. In the first case, an 8-bit color palette is used, and in the second, 24-bit. Photo in PNG-8 format, compared to the GIF version, has a slightly better compression ratio and the lack of the ability to create animations. Despite the fact that such an image can contain a maximum of 256 colors, this algorithm is widely used to create graphic text, logos, illustrations with clear edges and images with gradient transparency. In cases where this is clearly not enough, developers use a 24-bit PNG format, which has a lot of additional advantages, such as:
- An improved compression algorithm that negates any quality loss.
- The ability to use alpha transparency provides 256 different levels of transparency.
- The presence of gamma correction, which allows you to automatically adjust the brightness of the picture when playing in different programs.
- The ability to use about 16.7 million color shades.
All this together contributes to the use of PNG24 for compression of any image containing transparent areas, images with a large number of colors and clear image borders.
Despite the fact that the distribution of the PNG format is still hampered by older browsers, as well as insufficient and incomplete support for the capabilities of this algorithm in new versions, PNG is very promising for web graphics. Compared to GIF, it has three main advantages: alpha channels, gamma correction, and two-dimensional interlacing (the method of progressive display of a picture). And in comparison with JPEG it has no quality loss. Note that the PNG format was invented on January 4, 1995. Since that time, 18 years have passed, and he began to lead in the use of websites, pushing GIF into second place.
Most custom graphics programs
(such as MS Paint) today have adopted it as the standard for saving files by default. Probably, if not for the animation and quirks of older versions of Internet Explorer, GIF would have given way to its rival even earlier.