Home
dbPix
Download
Order
Testimonials
Support
Tutorials
Samples
KnowledgeBase
Links
Revision History
Documentation
Search
Contact
Site Map

Graph: dbPix image storage vs OLE Embedding and Linking in Microsoft Access


JPEG

       
Contents
JPEG Compression - Quality & Loss
JPEG Compression - Generational Loss
Lossless JPEG Operations
JPEG Metadata - EXIF, IPTC, Color Profiles
Progressive JPEG Encoding
Suitable Images for JPEG Compression
JPEG Summary
JPEG Links
JPEG is one of the most widespread image formats in use today. It is widely supported & implemented, well standardized, and can achieve very-high compression ratios, making it a popular choice for storing and transmitting images in a wide variety of applications.

Getting the most out of JPEG - and avoiding the pitfalls - requires an understanding of some key aspects of this powerful image format.


JPEG Compression - Quality & Loss

  
Bookmark this page:
ADD TO DEL.ICIO.US 
ADD TO DIGG 
ADD TO WINDOWS LIVE 
ADD TO YAHOO MYWEB 
ADD TO ASK 
ADD TO GOOGLE 

JPEG compression is "Lossy"; every time an image is compressed (saved) in JPEG format the resulting image is not exactly the same as the original, the difference, or error, being the "loss".

JPEG allows control over how "lossy" the compression process is, trading-off higher quality for lower compression (i.e. better quality = larger file-size). With suitable images JPEG can achieve compression ratios of between 3 to 1 and 100 to 1, though in practice ratios between 5 to 1 and 40 to 1 are likely to be useful.

The images below illustrate the effect of different JPEG Quality settings. The "Difference" pane shows the difference between the original and the compressed image. Brighter areas are more different. Note that the difference values are scaled in order to be visible with typical monitor settings.

Effect of JPEG Compression at Various Quality Settings

Click a Quality value to see the results of JPEG compression at different Quality Settings:
JPEG Quality: 
90 
70 
50 
30 
10 

OriginalCompressedDifference
JPEG Compression - Original ImageJPEG Compression - Compressed ImageJPEG Compression - Compressed Image Difference
Compressed at 3x Zoom
JPEG Compression - Compressed Image at 3x Zoom

At higher quality settings the differences are located mainly around edges and primarily in the blue color (to which the human eye is less sensitive). As the quality is reduced (i.e. compression increased) the difference becomes more pronounced until the effects of compression (known collectively as "compression artifacts"), including JPEG blocks, are clearly visible.

Different applications and devices present the JPEG Quality setting in different ways. Some use a value from 1 to 100, from 1 to 10, or named presets (e.g. low, medium, high). It may also be refered to as "compression" (i.e. the inverse of quality).

The compression & quality achieved at a given setting depends on the image itself, and can vary from one application to another, so experimentation with typical images is recommended in order to determine optimum JPEG compression settings.

Note that a Quality value of 100/maximum (or minimum compression) is not equivalent to "lossless". Special "lossless" versions of JPEG do exist, but standard JPEG does not support a lossless mode.


JPEG Compression - Generational Loss

If images are repeatedly re-compressed using JPEG then additional error/loss accumulates. This happens, for example, if an image is saved in JPEG format then later opened and edited (modified in some way) and then saved again in JPEG format. Note that there are a few specific exceptions to this (see Lossless JPEG Operations - Rotate, Mirror, Crop).

The images below illustrate the effect of repeated JPEG re-compression at various Quality settings. The "Difference" pane shows the difference between an original JPEG image and after multiple re-compressions at various quality settings. Brighter areas are more different - note that the difference values are scaled in order to be visible with typical monitor settings.

Effect of Repeated JPEG Compression at Various Quality Settings

Click to see the results of repeated JPEG compression:
Number of Re-Compressions: 
2 
4 
8 

OriginalCompressedDifference
30 Quality
JPEG Compression - Original ImageJPEG Compression - Compressed ImageJPEG Compression - Compressed Image Difference
50 Quality
JPEG Compression - Original ImageJPEG Compression - Compressed ImageJPEG Compression - Compressed Image Difference
70 Quality
JPEG Compression - Original ImageJPEG Compression - Compressed ImageJPEG Compression - Compressed Image Difference
90 Quality
JPEG Compression - Original ImageJPEG Compression - Compressed ImageJPEG Compression - Compressed Image Difference

Although the image is visually very little different after multiple saves, the "Difference" pane shows accumulated loss with additional re-compressions. As with an initial compression operation, the loss is concentrated around edges, and predominantly effects blues. The accumulated loss can be minimized by using the same quality/compression setting in subsequent saves.


Lossless JPEG Operations - Rotate, Mirror, Crop

Certain operations can be performed directly on JPEG images without requiring an additional lossy compression cycle. "Lossless JPEG Rotation" allows rotation of a JPEG image through 90, 180 or 270 degrees (useful for rotating digital photos taken in "portrait" mode, or for correcting the orientation of scans). Lossless cropping and mirroring is also possible with JPEG. For more details see Lossless JPEG Rotation


JPEG Metadata - EXIF & IPTC Info and Color Profiles

The JPEG format can store extra information ("metadata") as well as the image itself. Common examples of this are EXIF Info, IPTC Info, and embedded color profiles.

  • EXIF info is stored in JPEG files by most digital cameras. It contains info such as date & time picture taken, exposure & camera settings and often a thumbnail image.

  • IPTC info can include a description, comments, copyright info, keywords etc. It is commonly used in press and news photography, photo libraries and archives etc.

  • Color Profiles contain information to accurately reproduce colors.
Note that many applications do not preserve JPEG metadata when editing or saving an image, so care should be taken to avoid losing this information accidentally.

There are also situations where it may be desirable not to include the metadata in an image. For example, when generating a thumbnail image for web use the EXIF info could add significantly to the file size, particularly if an EXIF thumbnail is included (which end-users would typically never see).

In DBPix you can control whether metadata is retained or removed during JPEG encoding by setting the "ImageKeepMetadata" property. By default DBPix will always preserve metadata wherever possible. Note that some operations do not support the retention of metadata, such as copying and pasting via the clipboard (which uses raw bitmaps that can't contain metadata).


Progressive JPEG Encoding

In contrast to "Baseline" JPEG encoding, "Progressive" encoding allows an initial low-quality version of an image to be displayed before the image has been completely received or decoded, rather like "Interlaced" GIF or PNG images. This is primarily of interest when images are being retrieved over lower-speed communication links, such as the World Wide Web. Note that some applications, such as the current version of Internet Explorer (at the time of writing), will not render the progressive steps of an image, just the final full quality version once the full image data has been received and decoded.

Note that when the image data is retrieved over a high-speed link (e.g. from a local disk file or database, or over a fast LAN connection) then displaying the additional low-quality versions can actually increase the overall time and CPU load of displaying the final image. For this reason DBPix does not display the progressive preview steps. However, DBPix can be used create progressively encoded JPEGs, e.g. for use on the web.

In DBPix you can control whether Progressive or Baseline (sequential) encoding is used during JPEG compression by setting the "JPEGEncoding" property.

Suitable Images for JPEG Compression

JPEG can be used with color and grayscale images. Color images generally achieve higher compression ratios than similar grayscale images.

JPEG gives best results with images such as digital & scanned photos with continuous tone variation, where the visible effects of JPEG compression are much less noticeable. Consequently higher compression ratios can be achieved with acceptable image quality.

JPEG performs less well with images such as computer generated artwork, and other graphics with large areas of solid color, where the visible effects of JPEG compression are more noticeable to the eye, even at higher JPEG Quality settings.


JPEG Summary

JPEG can be a good option for the archiving of original images, and for the storage of final/working images, particularly when handling bulk images, for example in database applications.

When working with JPEG images it is important to avoid repeatedly saving an image in JPEG format, which could lead to an accumulation of loss/error ("generational loss") and a corresponding degradation of image quality.

Image processing workflows should be designed to keep original copies of source images (in the original format), and generate JPEG output only at the final stage, using a lossless format for intermediate storage if required.

Care should be taken to preserve metadata where relevant (e.g. "master" images, photo archives), and remove it where not required (e.g. "working" thumbnails).

JPEG should only be used with suitable images, e.g. photos. It is not suitable for computer generated artwork with areas of solid color. Since JPEG is always lossy it may not be suitable for some applications, e.g. critical images used for medical diagnosis.


JPEG Links

The DBPix Image Control    http://www.ammara.com/
Joint Photographic Experts Group    http://www.jpeg.org/
World Wide Web Consortium (W3C) JPEG page    http://www.w3.org/Graphics/JPEG/
The JPEG FAQ, at faqs.org    http://www.faqs.org/faqs/jpeg-faq/


  
Bookmark this page:
ADD TO DEL.ICIO.US    ADD TO DIGG    ADD TO WINDOWS LIVE    ADD TO YAHOO MYWEB    ADD TO ASK    ADD TO GOOGLE