JPEG
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. |
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.)
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. | |
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.
Short Name | Name | Bytes | Payload | Purpose | Required? |
---|---|---|---|---|---|
SOI | Start Of Image |
|
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 |
|
none | Yes | |
Specifications
- ITU-T Rec. T.81 (originally CCITT Rec. T.81): The JPEG standard
- ITU-T Rec. T.83: Compliance testing
- ITU-T Rec. T.84: Extensions
- ITU-T Rec. T.86: Registration of JPEG Profiles, etc.
- ITU-T Rec. T.851: (JPEG-1)-based still-image coding using an alternative arithmetic coder
- ITU-T Rec. T.872: Application to printing systems
- ExifTool: The APP14 "Adobe" segment
- ISO/IEC 10918: Digital compression and coding of continuous-tone still images
- ISO/IEC 10918-1:1994 - Requirements and guidelines
- ISO/IEC 10918-1:1994/Cor 1:2005 - Patent information update
- ISO/IEC 10918-2:1995 - Compliance testing
- ISO/IEC 10918-3:1997 - Extensions
- ISO/IEC 10918-3:1997/Amd 1:1999 - Refer to SPIFF
- ISO/IEC 10918-4:1999 - Registration of JPEG profiles, ...
- ISO/IEC 10918-4:1999/Amd 1:2013 - Application specific marker list
- ISO/IEC 10918-5:2013 - Refer to JFIF
- ISO/IEC 10918-6:2013 - Application to printing systems
- ISO/IEC 10918-7:2019 - Reference software
- ISO/IEC 10918-1:1994 - Requirements and guidelines
- ISO/IEC 19566: JPEG Systems (a collection of JPEG-related standards)
- ISO/IEC 19566-1: Packaging of information using codestreams and file formats
- ISO/IEC 19566-2: Transport mechanisms and packaging
- ISO/IEC 19566-4: Privacy, security and IPR features
- ISO/IEC 19566-5: JPEG Universal Metadata Box Format (JUMBF)
- ISO/IEC 19566-6 - Refer to JPEG 360
- ISO/IEC 19566-7: JPEG Linked Media Format
- Final Call for Proposal for a JPEG Reference Software (2017-07)
Sample files
Metaformat files
- Synalysis grammar file (for Hexinator / Synalize It!; more details)
Links
- Wikipedia Page of JPEG
- Archive Team's page of JPEG
- jpeg.org/jpeg/ - Official website
- Inside a JPEG file - metacpan.org
- JPEG Dissected (image) - Github
Author(s) : Æ Firestone
Popular Pages
-
Type Programming /scripting language Paradigm Multi-paradigm: event-driven, functional, imperative, procedural, object-orie...
-
HDMV (High Definition Movie) mode is an interactive framework with the well-known features of DVD, but it's more advanced than DVD m...
-
MPEG-2 Transport Stream Type of format Container format for video, audio, data First released August 2004 Latest relea...