JPEG vs. PNG: When and why to use one format over another

In digital imaging, two image formats dominate: JPEG (or JPG) and PNG.

At first glance, a single image displayed in both formats may appear identical, but if you take a closer look and dig into the data, there are quite big differences between the two. One format is not necessarily better than another, as each format is designed to be used in specific circumstances based on your needs for image quality, file size, and more. Here’s what you need to know about both formats to make the most of their strengths and weaknesses.

What is the JPEG format?

Short for the Joint Photographic Experts Group — the team that developed the format — JPEG has become the standard compressed format in digital photography and online image sharing due to its careful balance between file size and image quality.

The exact ratio varies depending on the program and settings used, but JPEG images generally have a compression ratio of 10:1. If you start with a 10MB image and export it as a JPEG, you’ll end up with an image of around 1MB. JPEGs should have almost zero quality difference, although this depends on the original image content and file type.

To do this, JPEG relies on discrete cosine transform (DCT). Although the calculations behind it are complicated, these compression algorithms look at the entire image, determine which pixels in the image are similar enough to the pixels around them, and combine the pixels in tiles (groups of pixels that have the same value).

This method is very efficient but results in loss of information that you cannot recover. JPEG images (with a few exceptions noted below) are lossy, meaning that once the image is saved, the lost data cannot be recovered. So, like making a photocopy of a photocopy, every time you open and save a JPEG file, it will look a little worse than before until it eventually loses all of its detail.

Therefore, JPEG is not recommended as an archive image format because if you need to open it and edit it again, the quality will suffer. Like Adobe Lightroom, nondestructive photo editors can help with this problem as long as you never delete your original files, as they simply save the edits as metadata rather than writing over the original image.

JPEGs should also be avoided with text-heavy images or illustrations with sharp lines, as defined lines tend to blur due to anti-aliasing. (Anti-aliasing is an intentional blur designed to eliminate rough edges.) As you can see in the image below, a screenshot taken from our homepage, the text and white background show a lot of artifacts in JPEG (right) compared to PNG (left).

However, there are times when you need to convert formats such as PDF to JPEG. In this case, it’s best to make sure you export it at the highest quality settings to ensure all text is sharp.

JPEG supports RGB and CMYK color spaces in 8-bit, but its CMYK offering leaves much to be desired. (Modern printers handle RGB files just fine, so this isn’t a big deal. However, it helps if you’re still stuck with a higher-quality printing format.)

Over the years, many variations of JPEG have come and gone. For example, JPG-LS was designed to correct for lost compression, but never gained a foothold and ultimately failed. JPG 2000 also attempted to address this lossless problem, but failed to gain traction. BPG, a new format based on the H.265 video standard, was determined to overtake JPEG but never quite succeeded.

The creators of JPEG recently shared a new format designed not to replace JPEG but to accompany it as an option for faster streaming. In JPEG XS, the compression is only six times instead of 10, but the simpler algorithm means the files are faster for streaming tasks. A potential replacement could be HEIF, which is also based on the H.265 standard. Where other companies failed, HEIF was able to succeed thanks to the support of one of the biggest brands in technology: Apple. There’s still a way to go, but more image editing programs and more devices are adding support for new formats, such as JPEG Plenum, which offers users an incredible set of tools that includes holographic imaging, texture-plus-depth, point clouds, and glow . field.

Excess Counter
Small file size Adverse compression
Integrated EXIF ​​support Not good for CMYK printing
Widely supported No transparency support

What is the PNG format?

Short for Portable Network Graphics, PNG is a lossless file format designed as a more open alternative to the Graphics Interchange Format (GIF).

Unlike JPEG which relies on DCT compression, PNG uses DCT compression LZW compression, which is the same as GIF and TIFF formats. In short, two-stage LZW PNG compression takes a sequence of bits contained in image data, then matches that longer sequence to short codes included in a dictionary (sometimes referred to as a codebook) stored in the image file. The result is a smaller file that maintains high quality.

The biggest advantage of PNG over JPEG is that the compression is lossless, meaning there is no loss of quality every time it is opened and saved again. PNG also handles detailed and high contrast images well. For this reason, PNG is more often the default file format for screenshots, as it can provide a nearly perfect pixel-by-pixel representation of the screen rather than compressing a group of pixels together.

One of the standout features of PNG is its support for transparency. With color and grayscale images, the pixels in a PNG file can be transparent. This allows you to create images that overlay neatly with image or website content. Many editing programs use checkered backgrounds to indicate graphic transparency. This makes PNGs great for logos, especially those containing text, used on websites. If you make a transparent background in Photoshop and save the image in JPG format, instead the transparent background will turn white because the format does not support transparency.

When it comes to photography, PNG may seem like a solid alternative to the RAW format for lossless image storage. But in reality, there are much better alternatives, such as Adobe’s Digital Negative (DNG) — which you can even record using your smartphone — and TIFF. PNG also doesn’t support it natively EXIF datawhich includes information such as shutter speed, aperture, and ISO of the camera used to capture it.

PNG was made for the web and has proven its worth. JPEG is probably the format of most images. However, PNG occupies an important position that JPEG cannot effectively reach. This is basically the only option when you need to render a logo or text clearly over other elements on a website. It is also widely used by archivists, preservationists, and other information scientists when digitizing documents, ephemera, and realia due to its high image quality and lossless compression.

Just like JPEG, PNG has also had several variations over the years. APNG is a format that is still supported designed to emulate the functionality of animated GIFs. This is not common but is supported by many modern browsers.

Another interesting tidbit is that in the early stages of PNG’s development, there was a suggestion to name it PING, short for “PING Is Not GIF,” a cheeky explanation of the creator of the GIF format.

Excess Counter
Lossless compression File size is larger than JPEG
Transparency support No native EXIF ​​support
Great for text and screenshots

Bottom line: What is the difference between JPEG and PNG, and which is better?

Ultimately, no image format is better than another. It’s just a matter of which one better suits your needs.

If you want to share photos from your camera on Instagram, Twitter, etc. Your best option is to use JPEG. It’s smaller, optimized for photography, and widely supported on almost every platform and service imaginable.

If you’re taking screenshots that you want to annotate or archive for later use, PNG will better suit your needs. The file size may be larger than an equivalent JPEG, but you don’t have to worry about losing quality every time you save, and you know every pixel is as sharp as the last time you opened it. As with logos, most web graphics are also better saved as PNG because they can take advantage of transparent areas.

Editor’s Recommendations






Leave a Comment