Difference Between PNG and JPEG

PNG and JPEG are two image formats used in computer graphics. JPEG is majorly used for photographic images while PNG is used for images such as logos. They use different methods for storing the image data; therefore carry inherent advantages and disadvantages in file size, image quality and transferability.

JPEG

JPEG images belong to the raster graphics image file format class, which produce the image by a bitmap or a dot matrix network of pixels. The JPEG standard defines a CODEC (Coder – Decoder) to code the image into a byte stream and decode the byte stream to reconstruct the image. In coding, the lossy compression skip/let go the details of the image to reduce the file size depending on the compression required. The degree of detail lost is a result of a tradeoff between storage size and the quality of the image. However, JPEG allows 24-bits input per pixel, which enables a true-color image when encoding. In most JPEG files, an ICC colour profile is embedded, such as sRGB or Adobe RGB.  

The JPEG file format performs at its best with realistic photographs or images with continuous, smooth colour and tonal changes. However, its performance is lower for line graphics such as logos, letters and cartoons, which has bold sudden change in the colours across the lines of pixels. Also, JPEG is not suitable for images which undergo repeated digital editing. A certain amount of detail is lost every time a compression and decompression is performed. Therefore, it is not suitable for images which require precision and high resolution such as scientific images, medical test images, and navigational charts.

 The 1992 release of JPEG Interchange Format (JIF) poses some practical difficulties and to overcome these shortcomings several other versions were introduced later. JPEG/File Interchange Format (JFIF) and JPEG/Exchangeable Image File Format (JPEG/Exif) are the most commonly used JPEG formats. JFIF is the most commonly used formats for world wide web while JPEG/ Exif is the most commonly used format for digital cameras and digital image editing.  

JPEG files use a variety of file extensions. .jpg,and .jpeg are the most common of the extensions. Depending on the platform and software, the extensions .jpe, .jif, .jfif, .jfi may be used.

PNG

PNG (pronounced as ping) is a file format developed as an open solution for the patented GIF file format. PNG stands for Portable Networks Graphics. PNG was developed for transferring images through the internet, and not for high quality print purposes.

PNG is a raster graphics format with lossless data compression. It supports palette-based images (with palettes of 24-bit RGB or 32-bit RGBA colours). Grey scale images (with or without alpha channel) and full-colour non-palette-based RGB images (with or without alpha channel) are also supported by PNG format. Since it is not developed for print purposes it does not support colour schemes such as CMYK, which are commonly used in the printing industry.

PMG files use the file extension .png

PNG vs JPEG

• Both PNG and JPEG are raster graphics; although JPEG uses lossy compression, PNG uses lossless data compression. Therefore, the JPEG file size can be lower than the PNG file size.

• JPEG images are best for photographic images with smooth transitions of colours, but PNG format is good for images with sudden changes in colour and contrast, such as text and cartoons.

• JPEG is not suitable for repeated editing, because of the lossy compression. PNG can be used for repeated editing and does not lose data during successive editing.