JPEG2000 vs JPEG vs PNG

Author: Fyodor Serzhenko

If you look for a list of image format standards with a good compression ratio, a simple Google search will yield a lot of results. JPEG and the similar sounding JPEG2000, along with PNG, are among the best image compression formats today.

That being said, each of these formats has their particular strengths and weaknesses. For us to be able to distinguish one from another, we have to look at each one separately. Once we have described each of the three image formats, we will compare them together so you can clearly see how they differ and which is right for you.

jpeg vs jpeg2000

There are other well-known raster image formats which were not included in our comparison. GIF is actively used nowadays for animations, but it is limited to 256-color palettes. TIFF is a classic lossless format with support of extended precision (16 bits per channel), but it has weak compression and is not supported by most web browsers. There are also a number of newer formats, like JPEG XR, WebP and HEIF, which are not really popular due to very restricted support in web browsers and image processing software.

What is JPEG?

The acronym JPEG stands for Joint Photographic Experts Group (the name is derived from the company who made it). It first appeared on the stage in 1986 but is still the most popular imaging format today.

JPEG should not be confused with JPEG2000. These names are similar because both standards were proposed by the same company, but they're completely different algorithms and formats; JPEG2000 is a more recent and much more sophisticated one.

JPEG is a lossy format, which means that encoding always causes a loss in quality. The compression ratio can be significantly increased at the cost of more losses. That's the main feature which made it so popular for compressing photographic images. They usually have smooth variations of brightness and color gradients, allowing JPEG to achieve a combination of good compression ratio with decent quality. However, the nature of the JPEG algorithm causes blocking artifacts (especially noticeable near sharp edges with high contrast), which can be distracting at high compression ratios.

JPEG Features

The JPEG compression algorithm has several important features which helped it to gain impressive popularity:

  • Color space transformation allows you to separate brightness (Y) and chrominance (Cb, Cr) components. Downscaling of Cb and Cr allows you to reduce file size with almost unnoticeable losses in quality.
  • Quantization after Discrete Cosine Transform (DCT) allows you to control reduction of image size by rounding coefficients for sharp (high-frequency) details.
  • Optional progressive encoding allows you to view a low-quality preview of the whole image after partial decoding of its byte stream.
  • Lossless entropy coding for DCT-transformed and quantized image data.

Pros and Cons of JPEG

When looked at as a whole, the features of JPEG make it a dependable format. Here are some of its advantages:

  • This format has been in use for quite a long time.
  • Almost all devices can support JPEG, which is not the case for JPEG2000.
  • It is compatible with most image processing apps.
  • JPEG images can be compressed up to 5% of their initial size. That makes JPEG format the more suitable one when it comes to transferring images over the web.
  • 8/12-bit support.
  • The JPEG codec can be very fast on a CPU and especially on a GPU.

Disadvantages of JPEG include:

  • Quality loss is inevitable after encoding and each iteration of import/export.
  • Due to ringing and blocking artifacts it distorts images with sharp edges, which become harder to recognize.
  • Only 1 or 3 color channels are supported.
  • It does not offer transparency preservation for images (there's no separate alpha-channel).

What is JPEG2000?

It’s easy to assume based on the name alone that JPEG2000 (or J2K) is similar in nature to JPEG. The truth is, all the two have in common is the name. The JPEG2000 algorithm was developed 8 years after JPEG took the stage, and was seen at that time as the successor to JPEG. The main idea behind the development of JPEG2000 was to create a more flexible and functional compression algorithm with a better compression ratio.

The JPEG2000 coding system is powered by a wavelet-based technology, which allows you to choose between mathematically lossless and lossy compression within a single architecture (and even within a single codestream). Discrete Wavelet Transform (DWT) processes the image as a whole, which prevents blocking artifacts compared to JPEG.

The use of DWT and a binary arithmetic coder allowed JPEG2000 to achieve a higher compression ratio compared to JPEG, especially at low bitrates. Although the compression performance was cited as the primary driver for the developers, in the end, applications have been attracted to it by its other advantages.

The codestream obtained after compression is highly scalable due to the use of EBCOT (Embedded Block Coding with Optimized Truncation). JPEG2000 allows you to select the order of progression of resolution, quality, color components, and position, supplying multiple derivatives of the original image. By ordering the codestream in various ways, applications can achieve significant performance increases or flexibly adapt to varying network bandwidth while transmitting an image sequence. For example, a gigapixel JPEG2000 image can be viewed with little delay, because only the display-size version can be read and decoded from the whole file. Another example is the ability to obtain a visually lossless image from the losslessly compressed master image, which can save time and bandwidth.

This format supports very large images (up to 232 – 1 on each dimension), multiple components (up to 16384 components for multi-spectral data), and a higher dynamic range (1–38 bits per component), where each component can have a different resolution and bit depth.

Actually, JPEG2000 is a whole family of standards, consisting of 12 parts. Its first part, the Core Coding System, specifies the basic feature set (encoding and decoding processes, codestream syntax, file format) and is free to use without payment or license fees. The additional parts include extensions giving more flexibility (extended file format JPX, Part 2), Motion JPEG2000 (file format MJ2, Part 3), multi-layer compound images (file format JPM, Part 6), a security framework (Part 8), the JPIP communication protocol (Part 9), a three-dimensional extension (JP3D, Part 10), etc.

Despite all its advantages, for various reasons JPEG2000 format didn't become as ubiquitous as its developers thought it would. If we compare JPEG2000 and JPEG, J2K is more complex and computationally demanding, so until recently (before sufficient development of processors and parallel algorithms) it was too slow in many practical cases. Another problem was that neither manufacturers nor regular customers were ready to adopt it in the early 2000s.

Today, JPEG2000 is considered to be a niche format and is mostly seen when acquiring images from scanners, medical imaging devices, cameras, satellites, geospatial imaging, digital cinema, broadcasting equipment, and high-end technical imaging equipment. However, now JPEG2000 has already reached maturity and is supported by plenty of consumer software and hardware, and there are solutions to most potential problems. So it still has potential for growth in acceptance and popularity.

JPEG2000 Features

The best way to understand the difference between JPEG and JPEG2000 is by looking at each of their features. Doing that helps us establish a relationship between the two and highlight the differences even more. The following are some of the most important features of JPEG2000:

  • Single architecture for lossless and lossy compression (even within a single image file)
  • Highly scalable codestream – the ability to supply versions of an image with different resolutions or quality from a single file
  • Support of very large size, window mode, multiple components, multiple tiles, very high dynamic range (up to 38 bits per component)
  • High compression (especially at low bitrates)
  • Error resilience (robustness to bit errors when communication or storage devices are unreliable)
  • Fast random access to different resolutions, components, tiles, positions and quality layers
  • Region-of-Interest (ROI) on coding and access
  • Support for domain-specific metadata in JP2 file format
  • Very low loss of quality across multiple decoding/encoding cycles
  • Creation of compressed image with specified size or quality

Pros and Cons of JPEG2000

JPEG2000 has some amazing features, and the advantages of using this image format over others are pretty impressive as well. Here are some of the reasons why you might want to use JPEG2000:

  • Has single compression architecture for both lossy and lossless compression
  • One master image replaces multiple derivatives (different resolutions and quality)
  • Works well for video production and live TV content
  • Works well with natural photos as well as synthetic visual content
  • Resilience to bit errors

JPEG2000 also has some disadvantages

  • It is not yet supported by web browsers (except Safari)
  • JPEG2000 is not compatible with JPEG. It takes additional time and effort to integrate JPEG2000 into a system or product even if it already uses the JPEG algorithm
  • Standard open-source JPEG2000 codecs are too slow for active use both for encoding and decoding

What is PNG?

PNG (or Portable Network Graphics) is another format that was created for lossless image compression. Today, PNG is the most popular image format on websites, and it is also expected to be the eventual replacement of GIF format, which is still actively used for animations. Actually, the replacement of GIF was the main motivation for creating PNG format, because the patented GIF format requires a license and has a well-known limit of a 256-color palette.

PNG uses the non-patented lossless compression algorithm Deflate, which is a combination of LZ77 and Huffman coding. The progressiveness feature of PNG is based on an optional 2-dimensional 7-pass interlacing scheme, which, however, reduces the compression ratio when used.

A PNG file's size depends on color depth (up to 64 bits per pixel), using a predictive filter on the precompression stage, implementation of Deflate compression, optional interlacing, and optional metadata. Several options for lossy compression were developed for this format: posterization (reduction of the number of unique colors), advanced palette selection techniques (reduction of 32-bit colors to 8-bit palette), and a lossy averaging filter.

GIF supports animation, but it was decided that PNG should be a single-image format. However, in 2008 an extension to PNG called APNG (animated PNG) was proposed, and now it is supported by all major web browsers except Microsoft IE/Edge. However, even Edge will start supporting it soon, because in December 2018, Microsoft announced that they would start using Chrome’s Blink engine in the Edge browser while discontinuing development of its own proprietary browser engine, EdgeHTML.

PNG supports color correction data (gamma, white balance, color profiles). Correction is needed because the same numeric color values can produce different colors on different computer setups, even with identical monitors. However, practical usage of this feature may become a problem, and this information is often removed by PNG optimization tools.

PNG Features

PNG has several main features that allowed it to become the most popular lossless format for synthetic raster images. Let’s briefly look at each one:

  • Lossless compression
  • Support of alpha-channel transparency (unique among the most popular web image formats)
  • 7-pass progressiveness
  • The PNG compression algorithm is able to process true-color, grayscale, and palette-based types of images from 1-bit to 16-bit (unlike JPEG, which supports only the first two and only for 8 or 12 bits)
  • Several choices of trade-off between compression ratio and speed

Pros and Cons of PNG

PNG compression is practical, and that makes it a really popular tool for storage and transmission of synthetic and computer-generated graphical images. Here are some additional advantages of this format:

  • Wide support by web browsers and other software
  • No patent issues
  • Alpha channel for adjustable transparency of pixels (opacity)
  • High dynamic range (up to 16 bits per channel)

However, PNG is not perfect, and has its drawbacks too:

  • No built-in support of lossy compression
  • Low compression ratio due to outdated compression algorithm
  • No built-in support of animations (only in extensions such as APNG)

What's better: JPEG vs JPEG2000 vs PNG

  Advantages Disadvantages
JPEG2000
  • Both lossy and lossless compression
  • Flexible progressive decoding
  • Very good image compression ratio
  • Error resilience
  • Not universally supported by browsers
  • Very high computational complexity
JPEG
  • Compatible with all web browsers
  • Supported by almost all image processing software and devices
  • Progressive mode support
  • Very fast both on CPU and GPU
  • No lossless mode in the original standard
  • Blocking artifacts
  • No transparency preservation
PNG
  • Compatible with all web browsers
  • Reliable lossless compression
  • Full transparency control
  • Not suitable for strong lossy compression
  • Low compression ratio

 

Conclusion

Each of these three image formats can be useful for different tasks. JPEG is very fast and it's compatible with most devices and hardware, so it can be used almost everywhere today though with some image quality limitations. JPEG2000, on the other hand, is more useful for maintaining high quality of images and dealing with real-time TV and digital cinema content, while PNG is more convenient for online transfer of synthetic images. Each of them has unique properties that can be applied for storing and processing images in different situations.

Downloads for high performance GPU-based software (JPEG and JPEG2000)

Contact Form

This form collects your name and email. Check out our Privacy Policy on how we protect and manage your personal data.