Like a GIF, a PNG file is compressed in lossless fashion, meaning all image information is restored when the file is decompressed during viewing. A PNG file is not intended to replace the JPEG format, which is "lossy" but lets the creator make a trade-off between file size and image quality when the image is compressed. Typically, an image in a PNG file can be 10 percent to 30 percent more compressed than in a GIF format.
File format of PNG
The PNG format includes these features:
- Not only can one color be made transparent, but the degree of transparency, called opacity, can be controlled.
- Supports image interlacing and develops faster than in interlaced GIF format.
- Gamma correction allows tuning of the image’s color brightness required by specific display manufacturers.
- Images can be saved using true color, as well as in the palette and grayscale formats provided by the GIF.
JPEG vs. PNG
JPEG and PNG are the two most commonly used image file formats on the web, but there are differences between them.
JPEG (Joint Photographic Experts Group) was created in 1986. This image format takes up very little storage space and is quick to upload or download. JPEGs can display millions of colors, so they’re perfect for real-life images, such as photographs. They work well on websites and are ideal for posting on social media.
Because JPEG is “lossy,” -- which means that when data is compressed, unnecessary (redundant) information is deleted from the file permanently -- some quality will be lost or compromised when a file is converted to a JPEG.
JPEG is the default file format for uploading pictures to the web, unless they have text in them, need transparency, are animated or would benefit from color changes, such as logos or icons.
However, JPEGs aren’t good for images that have very few color data, such as interface screenshots and other simple computer-generated graphics.
The main advantage of PNG over JPEG is that the compression is lossless, which means there’s no loss in quality each time a file is opened and saved again. PNG is also good for detailed, high-contrast images. Consequently, PNG is typically the default file format for screenshots because, instead of compressing groups of pixels together, it offers a nearly perfect pixel-for-pixel representation of the screen.
Another key feature of PNG is that it supports transparency. With both grayscale and color and images, pixels in PNG files can be transparent, enabling users to create images that overlay neatly with the content of a website or image.
Uses of PNG
PNG can be used for:
- Photos with line art, such as drawings, illustrations and comics.
- Photos or scans of text, such as handwritten letters or newspaper articles.
- Charts, logos, graphs, architectural plans and blueprints.
- Anything with text, such as page layouts made in Photoshop or InDesign then saved as images.
Advantages of PNG
The advantages of the PNG format include:
- Lossless compression -- doesn’t lose detail and quality after image compression.
- Supports a large number of colors -- the format is suitable for different types of digital images, including photographs and graphics.
- Support for transparency -- supports compression of digital images with transparent areas.
- Perfect for editing images – lossless compressions makes it perfect for storing digital images for editing.
- Sharp edges and solid colors -- ideal for images containing texts, line arts and graphics.
The disadvantages of the PNG format include:
- Bigger file size -- compresses digital images at a larger file size.
- Not ideal for professional-quality print graphics -- doesn’t support non-RGB color spaces such as CMYK (cyan, magenta, yellow and black).
- Doesn’t support embedding EXIF metadata used by most digital cameras.
- Doesn’t natively support animation, but there are unofficial extensions available.
History of PNG
PNG was developed by an Internet working group headed up by Thomas Boutell that came together in 1994 to begin creating the PNG format. At the time, the GIF format was already well-established. Their goal was to increase color support as well as provide an image format that didn’t need at patent license.
The GIF format was owned by Unisys and its use in image-handling software involved licensing or other legal considerations. Web users could make, view and send GIF files freely but they couldn’t develop software that built them without an arrangement with Unisys.
The first PNG draft was issued on January 4, 1995, and within a week, most of the major PNG features had been proposed and accepted. Over the next three weeks, the group produced seven important drafts.
By the beginning of March 1995, all the specifications were in place (draft nine) and accepted. In October 1996, the first version of the PNG specification was issued as a W3C recommendation. Additional versions were released in 1998, 1999 and 2003, when it became an international standard.