APPn segment.

JPEG has sixteen numbered slots for application data, and the number in the slot is almost useless for deciding what is inside it.

// definition

An APPn segment is one of sixteen marker types, APP0 through APP15 (0xFFE00xFFEF), reserved by the JPEG standard for application-specific data. Each carries a two-byte length and a payload that conventionally begins with a NUL-terminated identifier string naming its owner.

What it is

A JPEG file is a sequence of segments: a start marker, then a run of marked blocks, then the compressed image data, then an end marker. Application segments sit in that run, before the picture. They are the standard's designated place for anything the standard itself does not define.

Sixteen slots was never enough for the number of things that wanted one, so the slots are shared and the identifier string at the front of the payload is what actually distinguishes them.

Why it matters

The two clearest cases are the two that matter most:

One of each pair is kept and the other dropped. Decide on the marker number and you either wreck the colours of every photo you touch, or you leave a second unscrubbed image in a file you promised to clean.

// in ScrubPony The marker code never decides. ScrubPony classifies every segment by comparing the front of its payload against a table of exact identifier byte strings — including the embedded NULs the specifications define, which is why the identifiers are written out literally in the source rather than derived with strlen. Run scrubpony -l on a file to see the marker, the payload length and the identifier for every segment in it.

Related terms

Common questions.

Why not just drop every APPn segment?

Because two of them carry display information rather than identity: JFIF density in APP0, and the ICC colour profile in APP2. Dropping those visibly changes how the picture looks, so they are kept by default. --strict drops them anyway.

What about COM segments?

The JPEG comment marker is separate from the APPn range and holds free text. ScrubPony drops it.

Get ScrubPony

Strips identifying metadata out of JPEGs without touching a pixel. C99, no dependencies beyond libc, macOS and Linux, MIT-licensed.