MetaPurge

ICC profiles and EXIF orientation: the two tags worth keeping

Most metadata can go without changing a single pixel. Two blocks are different: orientation decides which way up the image appears, and the ICC profile decides what its numbers mean as colour.

By Rajat Malik Updated 8 min read

A metadata remover that deletes everything is easy to write and produces broken images. Two blocks need to survive: the orientation tag, which tells a viewer how to rotate the stored pixels, and the ICC colour profile, which tells it what the numbers mean.

Neither describes a person, a place or a device owner. Keeping them costs nothing in privacy and prevents the two most visible failures of over-aggressive stripping.

The Orientation tag

Orientation is tag 0x0112, a SHORT value in IFD0, and it holds one of eight integers. It does not rotate anything. It records where row 0 and column 0 of the stored image sit relative to the image as it should be displayed, and the viewer applies the correction.

This exists because a camera sensor is physically fixed. Turn the phone to shoot a portrait and the sensor still writes a landscape frame; the orientation value is how the device says "the top of the scene is along this edge".

Most viewers honour it, including modern browsers, which apply image-orientation: from-image by default. Not all do: some thumbnailers, document converters and older libraries ignore the tag and show the raw frame.

The eight orientation values

The numbering comes from the TIFF specification. Values 1 to 4 are simple rotations and mirrors; 5 to 8 combine a transpose with a rotation, which is why they are the ones implementers get wrong.

ValueRow 0, column 0Correction to display
1Top, leftNone — the normal case
2Top, rightMirror horizontally
3Bottom, rightRotate 180°
4Bottom, leftMirror vertically
5Left, topTranspose: mirror, then rotate 270° clockwise
6Right, topRotate 90° clockwise
7Right, bottomTransverse: mirror, then rotate 90° clockwise
8Left, bottomRotate 270° clockwise

Value 6 is the common portrait case on phones: rotate the stored frame a quarter turn clockwise. Values 2, 4, 5 and 7 mostly come from scanners and mirrored front-camera captures.

What breaks when it is removed

Delete the tag and the pixel data still contains a landscape frame. A viewer that trusted the tag now shows a portrait photo lying on its side, and there is nothing in the file to say otherwise. The information is gone, not hidden.

There are two fixes, and they are not equivalent. The first is to keep a minimal EXIF block containing only tag 0x0112. The file stays small, the compressed data is untouched, and any viewer that honoured the tag before still does.

The second is to bake the rotation into the pixels and store the image upright. That works everywhere, including viewers that ignore the tag, but it requires re-encoding. For JPEG that means a lossy generation, although a coefficient-level rotation tool can do it without quality loss. For PNG and WebP lossless the pixels survive exactly, but the file bytes change.

Whichever you choose, decide once. A file that has been rotated but still carries the old orientation tag will display wrongly in exactly the viewers you were trying to satisfy.

What an ICC profile is

An ICC profile is a small binary file that maps between a device's colour encoding and a connection space, usually CIE XYZ or CIELAB. It begins with a 128-byte header — profile size, preferred CMM, version, device class, colour space, connection space, creation date and the signature acsp — followed by a tag table and the tagged element data.

Embedding differs by container. JPEG uses APP2 segments whose payload starts with ICC_PROFILE and a null byte, then a one-based chunk number and the total chunk count; a profile too large for one segment is split across several. PNG stores it compressed in an iCCP chunk with a profile name. WebP stores it uncompressed in an ICCP chunk and flags it in VP8X.

sRGB, Display P3 and the untagged file

sRGB uses the Rec. 709 primaries with a D65 white point. Display P3 uses the wider DCI-P3 primaries, also with D65, which extends the range of reds and greens a file can describe. The numbers in an image are just code values; the profile is what turns them into light.

Strip the profile and software has to guess. The usual guess is sRGB. Feed it Display P3 data and the colours are interpreted against narrower primaries, so saturated reds and greens come out duller and slightly shifted. The image looks flat rather than broken, which is why the problem often survives review.

The reverse mistake — tagging sRGB data as Display P3 — pushes colours outward and looks oversaturated. Neither is a rendering bug; both are the result of a missing or wrong description of the data.

Assigning is not converting Assigning a profile changes how existing numbers are interpreted and leaves the pixel values alone. Converting remaps the pixel values into the new space. If a wide-gamut photo looks wrong and you "fix" it by assigning sRGB, you have changed the appearance, not recovered the colour.

Neither tag identifies a person

Orientation is one integer from a set of eight. It says nothing about who took the photo, where, or with what. The ICC profile is a description of a colour space, and the common ones — sRGB IEC61966-2.1, Display P3 — are fixed public profiles that ship with operating systems and browsers.

There is a caveat. A custom profile created by a monitor calibration tool can carry a device description in its desc tag and a copyright string in cprt, and those strings sometimes include a machine name or an owner's name. Profile creation dates and profile IDs are also stored.

So the rule is not "ICC profiles are always anonymous". It is that a standard profile is anonymous, while a custom one deserves a look at its text tags. That is a much narrower check than deleting the profile and hoping the colours survive.

Keeping both

When you strip a file, keep the ICC segments intact, including every chunk of a split APP2 profile. Keep orientation by writing a minimal EXIF block with a single IFD0 entry rather than truncating the original segment. A malformed APP1 is worse than no APP1: some parsers reject the whole file.

Then check the result in a browser and a desktop viewer, because they do not always agree about orientation, and a dropped profile is only visible as a colour shift.

The EXIF overview lists everything else that can safely go. If you want the container details, see the JPEG guide and the PNG guide.

See what your photos are carrying

Drop an image in. MetaPurge lists every tag, then rewrites the file without touching a pixel.

Open the metadata remover

Where to go next

Rajat Malik Frontend architect and the author of MetaPurge. Builds browser tools that keep files on the device, and writes about the parts of the web that leak by default. rajatmalik.dev