What is the difference between the image format PNG-8 and PNG-24, and what are the advantages and disadvantages?
PNG, JPEG, and GIF are the three most commonly used image formats in daily contact. Almost all pictures on Internet pages are in these three formats. Dynamic images use GIF, and static images use PNG and JPEG.
Previous article “What are the differences between PNG, GIF, and JPEG image formats, and what are the advantages and disadvantages of each?
Introduced the difference between PNG image format and JPGE and GIF, their advantages and disadvantages, and the types of images suitable for storage. Now let’s talk about the PNG format in detail.
When using software such as Photoshop to save the PNG format, you may find that PNG is also divided into PNG-8 and PNG-24. What is the difference between these two formats?
Overall, PNG-8 and PNG-24 have the following three differences.
1. The number of indexes and stored color values are different
The 8 and 24 numbers behind PNG mean the maximum color values that can be indexed and stored in this format.
PNG-8 means to store up to 256 colors, which is 2⁸ = 256, 2 to the 8th power.
PNG-24 means to store up to 16 million colors, that is, 2²⁴ = 16 777216 colors, which is 2 to the 8th power.
2. Different transparency
PNG-8, like the GIF format, only supports a 1-bit Boolean transparency channel. The edges of the transparent and opaque areas of the picture are relatively rigid and do not support translucent effects.
PNG-24 supports the alpha translucent transition effect, that is, it can perfectly present the gradient transition from opaque to completely transparent.
3. The compression rate is different
So when storing PNG images, how should I choose PNG-8 or PNG-24?
A picture with a single color is suitable for storage in the PNG-8 format. Under the premise of lossless compression, the file can be losslessly compressed to the minimum without any impact on the definition.
The actual test found that the same picture, PNG-8 format has a greater compression rate than GIF. In addition, the number of colors can be set as small as possible without affecting the effect of the picture, so that the file will be smaller.
Compared to PNG-8, PNG-24 stores larger files. When storing photographic photos, with the same visual effects, PNG-24 files are much larger than JPEG. Therefore, PNG-24 is not suitable for storing photos and other pictures with more colors and rich details. It is mostly used to store pictures that need to preserve transparency and single color. For example, LOGO, picture watermark, and other files should be stored in PNG-24.