JPEG

From Just Solve the File Format Problem
Revision as of 16:08, 15 February 2013 by Jsummers (Talk | contribs)

Jump to: navigation, search
File Format
Name JPEG
Ontology
Extension(s) .jpg
.jpeg
.jpe
.jif
.jfif
.jfi
MIME Type(s) image/jpeg

JPEG, named after the Joint Photographic Experts Group, which created the format, is a lossy compressed format well-suited to photographic images. Line drawings do better with non-lossy compressed bitmaps such as GIF and PNG.

Properly speaking, JPEG refers to an encoding rather than a file format. JFIF (JPEG File Interchange Format) further specifies the particular subset of the JPEG standard intended to be used for standardized image files, skipping some of the advanced features of JPEG intended for specific application use. What are commonly called JPEG files are almost always JFIF files. The SPIFF file format was intended as a replacement for JFIF but never caught on widely.

Contents

Format

A JPEG file consists largely of a sequence of tagged segments. Each segment begins with a two-byte "marker". The first byte of a marker is 0xff. The second may have any value except 0x00 or 0xff, and indicates the type of data stored in the segment. Segment types are assigned names; for example, 0xd9 is "SOI", and 0xe1 is "APP1".

Segment types 0x01, and 0xd0 through 0xd9, consist entirely of the two-byte marker. All other markers are followed by a two-byte integer indicating the size of the segment, followed by the payload data contained in the segment.

The image data is the exception to this segmented format. It appears between the 0xda ("SOS") and 0xd9 ("EOI") segments, but there is no prefix to indicate its size. Instead, any 0xff bytes in the image data are escaped as 0xff 0x00, so that they won't be mistaken for markers.

Application segments

There are 16 segment types reserved for application-specific data: 0xe0 ("APP0") through 0xef ("APP15").

An APP segment's data usually begins with NUL-terminated string to identify the type of data contained in it. The actual payload data then begins after the NUL byte. This is a convention, not a part of the JPEG specification.

Related Formats

ICC profile data is contained in an APP2 "ICC_PROFILE" segment.

The Exif standard uses an APP1 "Exif" segment.

FlashPix data is contained in APP2 "FPXR" segments in Exif-compliant JPEGs. Refer to the Exif specification.

Photoshop Image Resources is contained in an APP13 "Photoshop 3.0" segment.

IPTC metadata often appears in JPEG files, embedded in Photoshop Image Resources.

XMP metadata is contained in an APP1 "http://ns.adobe.com/xap/1.0/" segment.

Many other file formats, such as TIFF, MNG, and DICOM, can contain JPEG-compressed data or encapsulated JPEG files.

Specifications

References

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox