Menu

1 / 4

Stripping EXIF from JPEGs without re-encoding: walking markers, keeping orientation, and an 8-hour bug

DEV Community: typescript·shaojie gong·7 days ago
#u6CirvaS
#devtotypescript#devto#dev#marker#exif
Reading 0:00
15s threshold

I'm the developer of MakeQuickWork, a small set of free browser tools. This is how its Remove EXIF tool works, including two bugs I found while taking the screenshots for this post.

The usual way to strip EXIF in a browser is to draw the image to a canvas and export it again. It works, and it's also a full decode and re-encode: you lose some quality, you lose the colour profile, and the file size jumps around. I wanted the opposite. Same pixels, same bytes for the image data, only the metadata gone.

So the tool doesn't touch the image at all. It rewrites the container. JPEG, PNG and WebP are all formats where metadata lives in separate, clearly labelled blocks, which means you can walk the file, skip the blocks you don't want and copy the rest.

The page is https://makequickwork.com/image/remove-exif/ . It runs in the tab; the photo isn't uploaded.

JPEG: walking the markers

A JPEG is a sequence of segments. Each starts with 0xFF plus a marker byte, and most carry a two-byte big-endian length.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.