JFIF (JPEG File Interchange Format) is a standard that defines a portable subset of the JPEG file format. Most of the JPEG files in existence conform to JFIF.
JFIF defines JPEG application segments which serve to identify JFIF files, and to store a small amount of metadata: the pixel density, and a thumbnail image.
The presence of a JFIF segment implies that:
- If the image has three components, its color format is YCbCr, using a conversion formula given in the specification. If it has one component, its color format is grayscale.
- The image has a particular orientation.
- If the image is subsampled, it uses a particular subsampling position.
JFIF was developed based on a draft version of the JPEG standard, which is how it can predate JPEG's official 1992 publication date.
Don't confuse JPEG File Interchange Format with JPEG Interchange Format. The former is JFIF; the latter means approximately the same thing as JPEG.
Valid JFIF files begin with
FF D8 FF E0 ?? ?? 'J' 'F' 'I' 'F' 00. Some technically-invalid files exist in which the JFIF segment has been relocated, and for them this signature will not match.
- The original version (let's call it JFIF 1.00) must have existed in some form, but little seems to be known about it.
- JFIF 1.01 (1991-12-10) may have changed the subsampling position to centered.
- JFIF 1.02 (1992-09-01) added an optional JFXX segment, capable of storing a compressed thumbnail image.
- JFIF 2.xx (~2014): Starting with version 9a, the Independent JPEG Group's software supports "JFIF 2.01" (e.g. using
cjpeg -bgycc), which apparently implies that the image uses "big gamut YCC". We have not located any specifications for this JFIF version. Note that some buggy JFIF encoders have been known to label a file as version 2.01, when 1.02 was intended.
- JFIF 1.02:
- Based on JFIF 1.02:
- JFIF 1.01