In this episode we deal with the digital traces that ride along in image files: EXIF, XMP, and other metadata. We learn how to remove them with strip, read and change them with set and format strings, and clean up GPS locations and author identity before images are published.

In episode 15 you controlled where images come from. This episode is about something subtler: what comes along inside the image itself. A JPEG photo from a modern smartphone doesn't just contain pixels — it contains the camera that took the shot, the shooting time, and often accurate GPS coordinates.
Episode 16 opens up the world of image metadata: what's stored behind the pixels, how to read it, change it, and — most importantly — how to clean it before an image crosses the publication boundary. In an era where a single GPS coordinate can reveal a home address, understanding metadata isn't a convenience; it's an obligation.
A JPEG image can carry more than one layer of metadata at once:
Imagine the pixels as the contents of a suitcase, and metadata as the labels stuck on its outside. Most people pay attention to the suitcase's contents — few remember that the label can speak louder than the contents. GPS coordinates are the most honest label: it never lies about where the photo was taken.
The most complete way to unpack the metadata suitcase is identify -verbose:
magick identify -verbose photo.jpgThe output is long and contains everything: from image properties like dimensions and colorspace, to the Properties block holding EXIF/XMP metadata. To go straight to the metadata without thousands of other lines, filter with a format string:
magick identify -verbose photo.jpg | grep -A 30 PropertiesUnder the Properties section you'll see keys like exif:GPSLatitude, exif:GPSLongitude, exif:Make, exif:Model, date:create, and date:modify. These are the lines to look for if you want to know what your photo reveals.
Tip
A quick check to see whether a file still carries location data: magick identify -format '%[EXIF:GPSLatitude] %[EXIF:GPSLongitude]'{:bash} foto.jpg. Empty output means the coordinates are gone; numbers mean the location is still embedded and not yet safe to publish.
To extract a single property into a script, -format is the right choice. ImageMagick's format strings use %[...] to read image properties:
magick identify -format '%[orientation]' photo.jpgmagick identify -format '%[EXIF:Make] %[EXIF:Model]' photo.jpgThe first command returns the photo's orientation (for example TopLeft or LeftBottom), the second returns the camera's make and model. These values can be used directly in shell scripts — for example to reject photos with an abnormal orientation, or to record which cameras your team uses.
When you're ready to publish an image, the main weapon is -strip — discarding all unnecessary metadata:
magick input.jpg -strip -quality 85 output.jpg-strip removes the ICC profile (from episode 11), comments, EXIF, XMP, and every property that isn't a pixel. The result is a naked image: only visual data. This is a mandatory step for images shown on the web — a photo uploaded by a user to your application has no reason to carry the user's home coordinates to another visitor's browser.
-strip works like sweeping out the whole house — effective, but crude. Sometimes you want to remove part of the metadata and keep the rest, for example keeping the orientation (which affects how the photo displays) while discarding the location. For that, there's per-key removal:
magick input.jpg -set 'exif:GPSLatitude' '' -set 'exif:GPSLongitude' '' out.jpgmagick input.jpg -set 'exif:Artist' '' -set 'exif:Copyright' '' out.jpg-set rewrites the value of a property; an empty value ('') removes it. This approach keeps the orientation and other data you want to preserve, while discarding location and identity — like removing certain labels from the suitcase instead of throwing the suitcase away.
Important
Never assume a single -set operation is enough. Metadata can live in several layers at once (EXIF, XMP, and IPTC). For images that will be published, combine selective removal with -strip as the final cleanup — and verify with identify -verbose that what should be gone really is gone.
The reverse direction is also useful: writing desired metadata — copyright, description, or internal labels:
magick input.jpg -set exif:Artist 'Arman Dwi Pangestu' \
-set exif:Copyright 'CC-BY 4.0' -set comment 'batch-prod' output.jpgThe lines above embed the author name, license, and comment into the output. Useful for asset tracking: the batch-prod comment lets every file be identified by where it came from — as long as the metadata isn't stripped by a later process.
A complete ritual that should become a habit in every pipeline accepting user photos:
magick input.jpg -auto-orient -strip -quality 85 out.jpg
magick identify -format '%[EXIF:GPSLatitude] %[EXIF:GPSLongitude]' out.jpgThe first command normalizes the orientation (-auto-orient), discards all metadata (-strip), and reduces the size. The second verifies the result — and since -strip has already run, it should only return empty characters. This verification step isn't a formality: it ensures that what should be gone really is gone.
EXIF metadata isn't the only digital trace that rides along. Image files also store:
date:create and date:modify — when the file was created and modified, often revealing work patterns.The right analogy: metadata is footprints in the mud, while optical characteristics are fingerprint patterns. -strip cleans the footprints easily; the camera fingerprint stays and can't be removed by ImageMagick. For highly sensitive photos, this awareness is enough — most publications don't need that level of forensics.
Warning
-strip never changes pixels — it only discards metadata. If you need to forensically obscure camera origin (not just GDPR compliance), it takes much deeper image processing techniques, beyond the scope of this episode. For normal publication needs, -strip plus verification is more than adequate.
Episode 16 closed the most often-forgotten privacy hole: metadata that rides along in image files. We learned to unpack the suitcase with identify -verbose, read a single property with the %[...] format strings, discard all metadata with -strip, remove selectively with -set, write copyright metadata for asset tracking, and clean GPS and identity before publication.
The core thing to remember: an image file is a double messenger — one for the eye, one for the machine. You control the first layer through pixels; the second layer can only be controlled through metadata, and that control is mandatory before an image leaves your server.
In the next episode 17 we return to the art of the image itself: advanced compositing and layers — combining many images, shadows and glows, and selective masking for per-region editing. See you then!