PNG (Portable Network Graphics) is a graphics file format for bitmaps based on a non-patent lossless compression algorithm.
What is a PNG File Format?
The PNG file was mainly developed to overcome the shortcomings of the GIF format, allows for the storage of images with more profound contrast and other vital data, and uses an image file .png extension.
PNG History
PNG was created in 1995 after Unisys announced it would enforce a software patent for the LZW data compression algorithm used by GIF.
There were other issues with the GIF format; for example, when computers already supported thousands or millions of colors, they had to limit this to 8-bit palettes of a maximum of 256 colors.
Originally, PNG was called a recursive acronym, meaning not GIF.
Although GIF supports animation, this file type was developed as a static image format and created as an animated variant of the MNG format.
PNG became a more used file type in August 1999 when Unisys ended its royalty-free patent licenses policy for free or non-commercial software developers.
The PNG Version 1.0 specification was released on July 1, 1996, and later came out as RFC 2083. The W3C recommended it in a very short time on October 1, 1996.
On December 31, 1998, version 1.1 was released with three new extensions or chunks with some minor changes. Version 1.2 was released on August 11, 1999. Because PNG is an international standard, it was recommended to everyone by the W3C on November 10, 2003.
File Segments Feature
There are a number of sections that store specific information about each image. Segments declare themselves critical or helpful so that a program that encounters an auxiliary segment and does not understand it can safely ignore it.
The segment-based structure is designed to extend the PNG format while maintaining compatibility with older versions.
Each partition has a header indicating its size and type, as well as a checksum of the data. Sections have a case-sensitive 4-letter name.
Using upper or lower case letters in this name provides information to decoders about unrecognized parts. If the first letter is capitalized, it indicates that this part is required. Otherwise, it will help.
Sections are required to read the file; if the decoder finds a vital part that it does not recognize, it should cancel it.
If the second letter is capitalized, this means that the section is public or private in the specification or registration of the special purpose sections.
This use of upper and lower case letters ensures that there is never any conflict between the general and private sections. The third letter must be capitalized to accommodate PNG specifications, and this is reserved for future expansion.
The fourth letter indicates whether the section is safe to copy if it is not recognized.
If it is lowercase, it is safe to copy the partition regardless of the number of changes the file has gone through, while the upper case can only be copied if there are no critical sections that have changed.
Understanding the Metadata Sections
Other attributes that can be saved in a PNG image are gamma values, background color, and text information. It also uses color corrections used by color management systems such as sRGB, and some Adobe programs, such as Photoshop, also have this system.
The first lowercase letter in these sections indicates that these are not required in the PNG specification, and the last lowercase letter indicates that it is safe to copy even if the application in question does not understand them.
Color Depth Feature
Images in PNG format can be indexed palette images and consist of more channels. If there are multiple channels, all channels have the same number of bits per pixel.
Official PNG specification bit depth per channel: usually, editing programs only name the total number of bits per pixel (color depth).
The number of channels depends on whether the image is grayscale or color and whether it has an alpha channel.
Indexed images are limited to a maximum of 256 colors. This color palette is stored with an 8-bit channel depth. The palette cannot have more colors than those marked with bit depth, i.e., 28 = 256 colors.
Image Transparency Rate
PNG offers a wide variety of transparency options, and even a single pixel can be transparent with actual color or grayscale, or an alpha channel can be added.
For images using palettes, an alpha channel can be added to the palette entries. The number of such stored values may be less than the total number of entries in the palette, and the rest of the entries will be considered entirely opaque.
Searching for pixels with double transparency can be done before any color reduction to prevent some pixels from accidentally becoming transparent.
Compression Feature
The compression method used in this format is also known as deflation.
In filtering methods, specification 1.2 defines a single filter type that includes 5-pixel value prediction modes that are very useful for improving compression, in which a filtering method is chosen that estimates the color of the image for each row of the image.
Thus, each pixel is based on the previous pixel colors and subtracts the predicted color from the current pixel color. These five methods are None, Sub, Up, Average, and Paeth.
These filters can drastically reduce the final file size of the input image. The compression algorithm may be interested in choosing the appropriate method that offers the most significant reduction.
The MIME media type is image/png and was approved on October 14, 1996.
Animation/Moving Image Feature
APNG is a PNG-based format that supports animation and supports the display of a single image if the decoder does not understand this format. It is accepted by browsers such as Firefox and Chrome, and the file extension is .png.
MNG is an image format that supports animation based on ideas and parts of PNG. However, it is a complex system and does not allow a single image to be displayed if GIF and APNG do.
PNG Comparison with Other Formats
Comparing GIF to PNG
In most cases, it provides better compression than GIF, but some applications make a poor selection of filtering methods, resulting in larger file sizes.
It supports 1-bit or binary transparency-indexed images, such as GIFs. This type of transparency does not require additional channels and allows only one color in the palette to appear 100% transparent.
This format offers millions of color depth formats and an alpha channel feature with transparency values in between, providing much richer and more accurate color ranges than GIF.
While GIF supports animation, this format does not.
Comparing JPEG to PNG
PNG and JPEG are image formats designed for different purposes, so only a general comparison can be made.
JPEG has a significant compression rate to the detriment of image quality and is an ideal file format for large images and photos, but it does not accept transparency.
It is a lossless format with excellent compression and is perfect for pictures with large areas of solid color or with slight color variation.
Additionally, it supports alpha channels and some extra features like gamma correction.
Advantages
The LZW compression algorithm, which uses the popular GIF graphics format, belongs to Unisys company.
Although the GIF format is patented, this does not prevent it from being the most widely used graphic format on the Internet for use on web pages.
Although it is unlikely that this will affect individual designers or even professionals and administrators of corporate websites, this format has proven to be used more in the Webspace.
The World Wide Web Consortium officially published this format in October 1996.
This is a free-to-use file type that does not require any license for applications that use, create, or edit images, like other image formats from this international consortium.
The PNG format allows you to create bitmap images with a high size compression ratio. It does not create any loss of quality like the GIF format but has higher average compression.
Although it looks like a GIF, it supports transparent backgrounds, allowing the image to integrate well with the actual background of the web page.
PNG is superior to GIF in supporting color depth of up to 16.7 million colors. GIF only supports a maximum of 256 different colors in the same image. PNG also has two compression modes, standard and progressive.