1

JPEG is not a file format. The two major formats are JFIF and Exif. Wikipedia page on JFIF says that:

JFIF is mutually incompatible with the newer Exchangeable image file format (Exif).

The two formats are quite similar though. What causes the incompatibility?

1 Answer 1

2

If you want to be 100% spec-conformant, JFIF and Exif are incompatible. In practice they can be mixed in a single file. That's because the incompatibility is caused by a single detail in both specs that is not important if you're mixing them.

Files in both formats have the same structure:

  1. Start of image marker: FF D8
  2. Any number of segments:
    • 2-byte segment type identifier
    • 2-byte segment length (excluding identifier bytes)
    • segment data
  3. Start of scan marker: FF DA
  4. Image data
  5. End of image marker: FF D9

Image data is identical in both formats. Segment types, their identifiers and content structures are in a large part identical. Other segments are unique for one of the formats and don't use identifiers from the other, so no incompatibility there either. The problem is that JFIF required the first segment in a file to be FF E0, while Exif requires FF E1. So indeed if a file is conformant with one of the specs, it automatically becomes non-conformant with the other.

I haven't toyed with JPEGs for a while, but the last time I checked all JPEG-consuming software that I've checked simply ignored segments that it didn't recognize. So if a program eg. assumes a file is Exif because it starts with a FF E1 segment, it would either still read and recognize FF E0 (not very useful, since it duplicates information from FF E1) or skip it. All FF Ex segments should be ignored according to spec if the program doesn't recognize them.

1
  • 2
    Funny fact: Windows Photo Viewer (at least in Windows 7, not sure about later versions) will read both verriants, but will always save files as JFIF, leaving the EXIF segment (if the file was originally EXIF) in the file as an additional segment. Thus creating files that are technically invalid.
    – Tonny
    Jun 18, 2021 at 13:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .