JPEG FAQ

Is JPEG free software?

There are no external rights or patents etc. of any kind to libjpeg now. Moreover, libjpeg is a library that is protected by copyright. Generally libjpeg can be used by any company free of licence fee. That is guaranteed by the JPEG licence. The licence is meant to prevent misuse of the library, such as non-documented origin or modifications. Libjpeg is recognized as open source, and the main site to get these sources from is ijg.org.

 

The new libjpeg library has several extentions and enhancements. Are they compatible with my old images? What can they help me?

The oldest JPEG images, say from 1991, can be decoded with the most recent libjpeg without any problem. So modern JPEG applictions are 100% backward-compatible regarding the image files. But JPEG cannot live on without innovations. Some of the innovations are

  • smart scale (scaling images without modifiying the image itself)
  • lossless compression (losslessness regarding the whole JPEG processing chain)
  • arithmetic coding (variant of lossless entropy coding stage, one component of the former)
  • extended color spaces (wide color gamut)

These extentions are not interfering with the normal encoding and decoding process. But they open new opportunities that naturally follow the fundamental properties of the DCT. They are extentions that just free the potential that was already contained in the basic model of the DCT (discrete cosine transform).

 

Why is libjpeg called reference software?

Libjpeg library is a product of the Independent JPEG Group (IJG). It was initially, in 1991, developed by this group (Tom Lane) following some proposals of the drafts of the ISO and ITU group, also called Joint Photographic Experts Group. After its first release libjpeg gained unexpected popularity and it made the IJG to produce new releases in short sequence.

With all these releases IJG felt that it should follow the founding ideas of the DCT, while neglecting ISO decisions when it became clear that they do not follow this founding idea. IJG libjpeg was the technical cornerstone to the history of the most successful media format ever.

Reference software is developed independent of its performance in particular software and hardware environments. It focuses on the faithful implementation of the fundamental ideas for image representation. It is optimized for the practical use in applications. But it can be further optimized for special environments.

 

How can I prepare my JPEG images for best display in the web browser?

There are standard procedures to prepare JPEG images for best display in the browser: resize the image to the ratio that is displayed on the website and compress it as much that it retains its optical quality. Before you do this you can enhance the color quality and contrast by the help of the filters of Photoshop, Gimp etc. Some Content Management Systems are able to resize the images according to the device on the fly (responsive images) as the page is loaded.

However, there are no fixed standards to display JPEG images in the browser. Every browser uses its own technique. Some of those rendering techniques may be outdated. So it is difficult to predict how an image is displayed in the browser. The best method to check this is by trial and error testing.

What the browser vendors today are calling JPEG support refers only to a limited set of JPEG features that date back to decades ago. They do not even support the ISO standards of JPEG rendering. JPEG reference (libjpeg 9) can do far more than the browser vendors support today.

 

Can JPEG be made to display transparency?

There would be no technical hindrance to display JPEG transparancy for any browser. But no browser has support of transparency of JPEG. If some browser vendor wants to display transparency he should agree with the IJG to declare a certain color channel as „transparent“. This „alpha-channel“ is yet to be declared by the respective organizations (ISO/ITU) and can easily be built into JPEG reference. The JPEG per se is able to support transparency, as any other general image format can do (like gif, tiff and png).

 

Why is JPEG compression lossy?

It is only a certain type of JPEG compression that is lossy. It is only the 8-point DCT that is programmatically not exactly reversible and therefore cannot exactly reproduce the normal pixel-based image representation. Unfortunatly it is only this type of compression that is supported by many image processing applications such as Photoshop or Gimp and by all web browsers.  Reference JPEG does not have a restricition to 8-point DCT size, but can use any DCT size from 1-point to 16-point. Only the 1-point and 2-point DCT sizes have the potential to make the JPEG processing chain completely lossless. Lossless compression on 1-point DCT basis is fully implemented in libjpeg version 9 and works well in the reference applications that use this library (e.g. cPicture, Directory Opus, PhotoLine or StudioLine Photo).

 

Which colorspaces are suitable for JPEG?

JPEG can work with any colorspace. For the purpose of image interchange there exists the JPEG File Interchange Format (JFIF) standard, which defines several standard colorspaces to be used for interchange of JPEG images. Version 2 of JFIF also covers wide color gamut variants.