JPEG

JPEG Logo
Type of format Lossy image compression format
First published Part 1 September 18, 1992
Latest version Part 7 November 2023
Designed by Experts
Developers Joint Photographic Experts Group, IBM, Mitsubishi Electric, AT&T, Canon Inc
Filename extension .jpeg .jpg
Open Format? Yes (All pantents expired)
Free Format? Yes (All pantents expired)
Magic Number ff d8 ff

JPEG is a lossy raster image format created in 1992 by the Joint Photographic Experts Group. It's one of the graphics formats that can be used in BD-J mode. It was designed for realistic photographic images.

Blu-ray supports the standard JPEG format as defined in ISO/IEC 10917-1 using the JFIF file extension format, but it does not support Lossless JPEG, JPEG 2000, JPEG XT, and JPEG XL formats. JPEG images is commonly used for BD-J backgrounds but can be used to display photo galleries (though most developers use MPEG for that).

A basic example of an JPEG image.
 

Unlike PNG, which is lossless, JPEG is lossy, using DCT compression. The format's compression algorithm operates best with photographs and paintings of realistic scenes with smooth variations of tone and color. PNG can can do realistic images as well but takes up more space (unless it's super small), that is why JPEG is an ideal choice. 

 

Example of an BD-J menu using a JPEG file for the BD-J background behind the AVC video and PNG graphics.

 

 

Pros & Cons

Advantages

  • JPEG is an international standard and one of the most universally recognized image file format for distributing realistic photographs.
  • It supports 24-bit color which can display 16.7 million colors.
  • Their small file sizes allow quick transfer to the memory and fast access for viewing. By intelligently discarding all the colors that the human eye can’t pick out — called lossy compression — JPEGs keep their file size as small as possible. Compared to lossless formats like GIFs and PNGs, JPEGs are dramatically smaller in size.
  • Post-processing (image editing) is easier because white balance and saturation in JPEGs are set with the click of the shutter.

Disadvantages

  • Does not support transparency and only supports rectangular shapes.
  • Lossy compression may be a space-saver, but when dealing with very heavily compressed images, the quality will suffer. JPEG's lossy compression method means that some original image information is lost and cannot be restored, possibly affecting image quality
  • JPEG is not well suited for files that undergo multiple edits, as some image quality is lost each time the image is re-compressed, particularly if the image is cropped or shifted, or if encoding parameters are changed. Losing so much data may cause posterization — the loss of smoother transition between colors, making an image look flat and blocky. It may also cause the appearance of digital artifacts — which can severely affect image quality. To prevent image information loss during sequential and repetitive editing, the first edit can be saved in a lossless format (RAW, TIFF, PNG), subsequently edited in that format, then finally published as JPEG for distribution.

 

Compression ratio and artifacts

Those who use the Web (Facebook, 4Chan, etc.) may be familiar with the irregularities known as compression artifacts that appear in JPEG images, which may take the form of noise around contrasting edges (especially curves and corners), or "blocky" images. These are due to the quantization of the JPEG algorithm. They are especially noticeable around sharp corners between contrasting colors (text is a good example, as it contains many such corners). 

In the example below, is of two versions of the same image with the same size around 9 KB. On the left is PNG (8-bit) and the right is JPEG.

Click Image to enlarge.
The PNG version is crisp and clean, while the JPEG version (70% quality) shows the digital artifacts. If we wanted to get rid of the artifacts, we can reduce the compression and increase the quality by 100%. However, it will take up more storage size of 26 KB. This is why PNG is suitable for simple and small graphics.

These artifacts can be reduced by choosing a lower level of compression; they may be completely avoided by saving an image using a lossless file format, though this will result in a larger file size.

Certain low-intensity compression artifacts might be acceptable when simply viewing the images, but can be emphasized if the image is subsequently processed, usually resulting in unacceptable quality. Consider the example below, demonstrating the effect of lossy compression on an edge detection processing step.

Since the quantization stage always results in a loss of information, JPEG standard is always a lossy compression codec. (Information is lost both in quantizing and rounding of the floating-point numbers.)

Sample photographs
Image Quality Size (bytes) Compression ratio Comment
Highest quality (Q = 100) 81,447 2.7:1 Extremely minor artifacts
High quality (Q = 50) 14,679 15:1 Initial signs of subimage artifacts
Medium quality (Q = 25) 9,407 23:1 Stronger artifacts; loss of high frequency information
Low quality (Q = 10) 4,787 46:1 Severe high frequency loss leads to obvious artifacts on subimage boundaries ("macroblocking")
Lowest quality (Q = 1) 1,523 144:1 Extreme loss of color and detail; the leaves are nearly unrecognizable.


Note: The above images are not IEEE / CCIR / EBU test images, and the encoder settings are not specified or available.

 

Structure & Syntax

A JPEG image consists of a sequence of segments, each beginning with a marker, each of which begins with a 0xFF byte, followed by a byte indicating what kind of marker it is. 

Common JPEG markers
Short Name Name Bytes Payload Purpose  Required? 
SOI Start Of Image

0xFF, 0xD8

none Yes
APP0 Aapplication data 0xFF, 0xD8 none Yes
SOF0 Start Of Frame (baseline DCT) 0xFF, 0xC0 variable size Indicates that this is a baseline DCT-based JPEG, and specifies the width, height, number of components, and component subsampling (e.g., 4:2:0). Yes
SOF1 Start Of Frame (Extended Sequential DCT) 0xFF, 0xC2 variable size Indicates that this is a Extended Sequential DCT-based JPEG, and specifies the width, height, number of components, and component subsampling (e.g., 4:2:0). No
SOF2 Start Of Frame (progressive DCT) 0xFF, 0xC2 variable size Indicates that this is a progressive DCT-based JPEG, and specifies the width, height, number of components, and component subsampling (e.g., 4:2:0). No
DHT Define Huffman Table(s) 0xFF, 0xC4 variable size Specifies one or more Huffman tables. Yes
DQT Define Quantization Table(s) 0xFF, 0xDB variable size Specifies one or more quantization tables. Yes
DRI Define Restart Interval 0xFF, 0xDD 4 bytes Specifies the interval between RSTn markers, in Minimum Coded Units (MCUs). This marker is followed by two bytes indicating the fixed size so it can be treated like any other variable size segment. ?
SOS Start of Scan 0xFF, 0xDA variable size Begins a top-to-bottom scan of the image. In baseline DCT JPEG images, there is generally a single scan. Progressive DCT JPEG images usually contain multiple scans. This marker specifies which slice of data it will contain, and is immediately followed by entropy-coded data. Yes
RSTn Restart 0xFF, 0xDn (n=0..7) none Inserted every r macroblocks, where r is the restart interval set by a DRI marker. Not used if there was no DRI marker. The low three bits of the marker code cycle in value from 0 to 7. ?
APPn Application-specific 0xFF, 0xEn variable size For example, an Exif JPEG file uses an APP1 marker to store metadata, laid out in a structure based closely on TIFF. No
COM Comment 0xFF, 0xFE variable size Contains a text comment. No
EOI End Of Image

0xFF, 0xD9

none Yes


Note: These are common markers you'll occasionally find inside of JPEG files, but there are dozens of more markers.

 

Specifications

Sample files

Metaformat files

Links


Author(s) : Æ Firestone

on Wednesday, March 27, 2024 | , | A comment?
0 responses to “JPEG”

Leave a Reply

Popular Pages