JPEG File Interchange Format

From Wikipedia, the free encyclopedia

JPEG File Interchange Format (JFIF) is an obsolete standard which extends the JPEG Interchange Format (JIF) with which it is often confused. The latest version is v1.02 published September 1, 1992, and is available here.

The JPEG Interchange Format (JIF), which is defined in ISO/IEC IS 10918-1 | ITU-T Recommendation T.81 has some limitations that prevent it from being a complete universal image standard. The JPEG File Interchange Format standard attempted to provide a solution to these limitations.

All aspects of this standard have been superseded by the Exchangeable image file format standard.


Contents

[edit] Colour Space

The JPEG standard (ISO/IEC IS 10918-1 | ITU-T Recommendation T.81) does not define which colour space is to be used for images. JFIF specified that all conforming files must use YCbCr as defined by CCIR 601

Most systems ignore this and use sRGB instead.

[edit] Component Sample Registration

The JPEG standard also does not define how sub-sampled component samples should be aligned. The JFIF standard specifies that component samples must always be centred (horizontally and vertically) with respect to the group of highest resolution samples.

[edit] Pixel Aspect Ratio

Again there is no guide for pixel aspect ratios within the JPEG standard. JFIF provides aspect ratio information using an application segment extension to JPEG. It uses Application Segment #0, with a segment header of 'JFIF\x00', and specifies that this must be the first segment in the file, hence making it simple to recognise a JFIF file.

Field Size (bytes) Description
APP0 Marker 2 Always equals 0xFFE0
Length 2 Length of segment excluding APP0 marker
Identifier 5 Always equals "JFIF\x00" (0x4A46494600)
Version 2 First byte is major version (currently 0x01), Second byte is minor version (currently 0x02)
Density Units 1 Units for pixel density fields
  • 0 - No units, aspect ratio only specified
  • 1 - Pixels per Inch
  • 2 - Pixels per Centimetre
X Density 2 Integer horizontal pixel density
Y Density 2 Integer vertical pixel density
Thumbnail Width 1 Horizontal size of embedded JFIF thumbnail in pixels
Thumbnail Height 1 Vertical size of embedded JFIF thumbnail in pixels
Thumbnail Data 3 * Thumbnail Width * Thumbnail Height Uncompressed 24 bit RGB raster thumbnail


[edit] JFIF Extension (JFXX)

An optional second application segment allows a thumbnail image to be embedded using several different image formats (to save space).


Field Size (bytes) Description
APP0 Marker 2 Always equals 0xFFE0
Length 2 Length of segment excluding APP0 marker
Identifier 5 Always equals "JFXX\x00" (0x4A46585800)
Thumbnail Format 1 Specifies what data format is used for the thumbnail:
  • 0x10 - JPEG format
  • 0x11 - 1 byte per pixel palettised format
  • 0x13 - 3 byte per pixel format
Thumbnail Data Variable

JPEG
Must be JIF format using YCbCr or just Y, and must not contain JFIF or JFXX segments.

One Byte per pixel

Field Size (bytes) Description
Thumbnail Width 1 Horizontal size of embedded JFIF thumbnail in pixels
Thumbnail Height 1 Vertical size of embedded JFIF thumbnail in pixels
Thumbnail Palette 768 256 palette entries giving 24-bit colour values
Thumbnail Data Thumbnail Width * Thumbnail Height Pixel data - each value gives a position within the palette.

Three Bytes per pixel

Field Size (bytes) Description
Thumbnail Width 1 Horizontal size of embedded JFIF thumbnail in pixels
Thumbnail Height 1 Vertical size of embedded JFIF thumbnail in pixels
Thumbnail Data 3 * Thumbnail Width * Thumbnail Height Uncompressed 24 bit RGB raster thumbnail


[edit] History

The standard was established on March 1, 1991 in a meeting at C-Cube Microsystems involving representitives of many companies, including C-Cube Microsystems, Radius, NeXT, Storm Tech, the PD JPEG group, Sun, and Handmade Software.