JPEG2000 vs JPEG vs PNG

If you look for a list of image format standards with 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.

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 by 256 color palettes. TIFF is a classical lossless format with support of extended precision (16 bits per channel), but it has weak compression and is not supported by most of the 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 Expert 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 alike, because both standards were proposed by the same company, but they are completely different algorithms and formats; JPEG2000 is more recent and much more sophisticated one.

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

JPEG Features

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

  • Color space transformation allows to separate brightness (Y) and chrominance (Cb, Cr) components. Downscaling of Cb and Cr allows reducing file size with almost unnoticeable losses of quality.
  • Quantization after Discrete Cosine Transform allows to control reduction of image size by rounding coefficients for sharp (high-frequency) details.
  • Optional progressive encoding allows to show 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 of the image processing apps
  • JPEG images can be compressed up to 5% of their initial size. It makes JPEG format more suitable one when it comes to transferring images over the Web
  • JPEG codec could be very fast on CPU and especially on 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 of 8/12-bit depth are supported
  • Does not offer transparency preservation for images (no separate alpha-channel)

What is JPEG2000?

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

JPEG2000 coding system is powered by a wavelet-based technology, which allows 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 binary arithmetic coder allowed to achieve higher compression ratio compared to JPEG, especially at low bitrates. Although the compression performance was cited as a primary driver for the developers’ activity, 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 scheme (Embedded Block Coding with Optimal Truncation). J2K allows to select order of progression of resolution, quality, color components and position supplying multiple derivatives of the original image. By ordering codestream in various ways, applications can achieve significant performance increases or flexibly adapt to varying network bandwidth during transmission of image sequence. For example, gigapixel J2K-image can be viewed with a little delay, because only display-size version can be read and decoded from the whole file. Another example is ability to obtain 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), higher dynamic range (1–38 bits per component), where each component can have different resolution and bit depth.

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

Despite all its advantages, JPEG2000 format didn’t become as ubiquitous as its developers thought it would be for various reasons. 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 early 2000s.

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

JPEG2000 Features

The most efficient way to understand the difference between JPEG and JPEG2000 is by looking at each of their features. Knowing this, helps us form a relationship between the two to 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 — ability to supply versions of image with different resolutions or quality from a single file
  • Support of very large size, multiple components, 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, 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 compression 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 compressions
  • One master image replaces multiple derivatives (different resolutions and quality)
  • Suits well for video production and working with live TV content
  • Works well with natural photos as well as synthetic visual content
  • Resilience to bit-errors.

JPEG2000 also has the following disadvantages:

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

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 patented GIF required license and has well-known limit of 256 color palettes.

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

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

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

PNG has support of 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 raster synthetic images. Let’s briefly look at each one:

  • Lossless compression
  • Support of alpha-channel transparency (unique among the most popular in web image formats)
  • 7-pass progressiveness
  • PNG compression algorithm is able to process true-color, grayscale, and palette-based types of images from 1-bit to 16-bit (unlike the JPEG that 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 a practical one 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)

PNG is not perfect and has its own drawbacks too:

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

What is better: JPEG vs JPEG2000 vs PNG

JPEG2000

Advantages

  • Both lossy and lossless compression
  • Flexible progressive decoding
  • Very good image compression ratio
  • Error resilience

Disadvantages

  • Not universally supported by browsers
  • Very high computational complexity

JPEG

Advantages

  • Compatible with all web browsers
  • Supported by almost all image processing software and devices
  • Very fast either on CPU or GPU

Disadvantages

  • No lossless mode in the original standard
  • Blocking artifacts
  • No transparency preservation

PNG

Advantages

  • Compatible with all web browsers
  • Reliable lossless compression
  • Full transparency control

Disadvantages

  • Not suitable for strong lossy compression
  • Low compression ratio

Conclusion

Each of these three image formats can be useful for different tasks. JPEG is compatible with most devices and hardware, so it can be used almost everywhere today though with some quality limitations. JPEG2000, on the other hand, is more useful for maintaining high quality of images and dealing with real-time TV 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.

Original article see here: https://www.fastcompression.com/blog/jpeg-j2k-png-review.htm

Subscribe to our mail list: https://mailchi.mp/fb5491a63dff/fastcompression

--

--

No responses yet