JPEG File Interchange Format, Version 1.02
5
JPEG File Interchange Format Specification
The syntax of a JFIF file conforms to the syntax for interchange format defined in Annex B
of ISO DIS 10918-1. In addition, a JFIF file uses APP0 marker segments and constrains
certain parameters in the frame header as defined below.
X'FF', SOI
X'FF', APP0, length, identifier, version, units, Xdensity, Ydensity, Xthumbnail,
Ythumbnail, (RGB)n
length (2
bytes)
Total APP0 field byte count, including the byte
count value (2 bytes), but excluding the APP0
marker itself
identifier
(5 bytes)
= X'4A', X'46', X'49', X'46', X'00'
This zero terminated string ("JFIF") uniquely
identifies this APP0 marker. This string shall
have zero parity (bit 7=0).
version
(2 bytes)
= X'0102'
The most significant byte is used for major
revisions, the least significant byte for minor
revisions. Version 1.02 is the current released
revision.
units
(1 byte)
Units for the X and Y densities.
units = 0: no units, X and Y specify the pixel
aspect ratio
units = 1: X and Y are dots per inch
units = 2: X and Y are dots per cm
Xdensity
(2 bytes)
Horizontal pixel density
Ydensity
(2 bytes)
Vertical pixel density
Xthumbnail
(1 byte)
Thumbnail horizontal pixel count
Ythumbnail
(1 byte)
Thumbnail vertical pixel count
(RGB)n
(3n bytes) Packed (24-bit) RGB values for the thumbnail
pixels, n = Xthumbnail * Ythumbnail
[ Optional JFIF extension APP0 marker segment(s) - see below ]
·
·
·
X'FF', SOFn, length, frame parameters
Number of components
Nf
= 1 or 3
1st component
C
1
= 1 = Y component
2nd component
C
2
= 2 = Cb component
3rd component
C
3
= 3 = Cr component
·
·
·
X'FF', EOI