The markers APP0 to APP15 hold data the compression does not
need. T.81 only reserves them; the layouts come from other documents. Each of the common
ones starts with an identifier that says whose it is. A segment body can be at most
65,533 bytes (the length field takes 2), so a long block such as an ICC profile is
split into pieces.
The common segments
| Marker | Identifier | Holds |
|---|---|---|
APP0 (E0) | JFIF\0 | JFIF: version, pixel density, optional thumbnail |
| APP0 | JFXX\0 | A JFIF extension: a thumbnail |
APP1 (E1) | Exif\0\0 | Exif metadata, in a TIFF layout |
| APP1 | http://ns.adobe.com/xap/1.0/\0 | An XMP packet (XML) |
| APP1 | http://ns.adobe.com/xmp/extension/\0 | A piece of an XMP packet too long for one segment |
APP2 (E2) | ICC_PROFILE\0 | A piece of an ICC colour profile |
| APP2 | MPF\0 | Multi-Picture Format: further images in the file |
APP12 (EC) | Ducky | Save for Web settings from Photoshop |
APP13 (ED) | Photoshop 3.0\0 | Photoshop image resources, including IPTC text |
APP14 (EE) | Adobe | Colour transform used by Adobe programs |
JFIF
JFIF (ITU-T T.871) defines the first segment of many files, directly after SOI. It says the components are Y, Cb and Cr (or Y alone), with the transform shown on the coding page.
0IdentifierJFIF\05 bytes5Version major, then minor2 bytes7Units of the pixel density1 byte8Xdensity2 bytes10Ydensity2 bytes12Xthumbnail thumbnail width, 0 for none1 byte13Ythumbnail thumbnail height1 byte14Thumbnail RGB pixels, top row first3 × X × Y bytes
| Units | Meaning |
|---|---|
| 0 | No units: the densities are a pixel aspect ratio |
| 1 | Dots per inch |
| 2 | Dots per centimetre |
A JFXX segment (JFXX\0, then 1 byte) holds a thumbnail in another form:
10 a whole JPEG, 11 width, height, a 768-byte palette and 1-byte
pixels, 13 width, height and RGB pixels.
Exif
After Exif\0\0 the body is a TIFF file: a byte-order header followed by
image file directories holding the camera's details, the date, the exposure, the location
and usually a thumbnail. Offsets in it count from the start of the TIFF header, not from
the start of the file. Tags are described in the
TIFF reference and the Exif standard.
XMP
After the identifier comes an XMP packet of XML, up to one segment long. A larger packet
is split: the main segment holds the common part, and xmp/extension segments
hold the rest, each with the packet's 32-character GUID, the total size (4 bytes), this
piece's offset (4 bytes), and the bytes.
ICC profiles
A colour profile is split across APP2 segments, each with ICC_PROFILE\0, a
1-based piece number (1 byte), the number of pieces (1 byte), and the piece. The pieces
joined in order are the profile.
Multi-Picture Format
Some cameras store several images in one file, one after another. The first image's
APP2 MPF\0 segment, in a TIFF layout like Exif's, lists each image's type,
size and offset; the offsets count from the segment's TIFF header. The extra images sit
after the first image's EOI, and each is a whole JPEG file.
Photoshop and Adobe
APP13 holds Photoshop's image resources: each is 8BIM, a 2-byte ID, a
padded name, a 4-byte size, and data padded to an even length. A resource with ID
0404 holds IPTC text.
0IdentifierAdobe5 bytes5Version2 bytes7Flags 02 bytes9Flags 12 bytes11Transform colour transform1 byte
| Transform | Components |
|---|---|
| 0 | RGB, or CMYK with its values inverted |
| 1 | YCbCr |
| 2 | YCCK, with its values inverted |
Comments
A COM segment (FF FE) holds text of any kind, of no meaning to decoding.
T.81 does not say what encoding it uses.