ImageMagick
Instead of Exiftool, to handle Exif metadata (IPTC, XMP and ICC image metadata also) I found ImageMagick (install it with sudo apt install imagemagick
) more useful and command easier to remember.
Since IMv7magick identify/mogrify/...
it's used instead [1].
To read
identify -verbose image.jpg | grep exif
To remove
With imagemagick
package installed you can do this (not only for JPEGs):
mogrify -strip *.jpg # Optionally: -verbose
From manual:
-strip
strip the image of any profiles, comments or these PNG chunks: bKGD, cHRM, EXIF, gAMA, iCCP, iTXt, sRGB, tEXt, zCCP, zTXt, date.
Since you will lose the orientation metadata, maybe you'll want to mogrify -auto-orient image.jpg
first.
AFAIK the only difference with exiftool is that mogrify
won't remove this metadata:
- JFIF Version
- Resolution Unit
- X Resolution
- Y Resolution
Which might be useful. Compared with diff -y <(exiftool wMogrify.jpg) <(exiftool wExiftool.jpg)
Remove EXIF data is not the same as anonymize: -strip
will recompress the image. This might be a good thing: The same software that take the photo (or other) could hide sensitive information (which may be encrypted) inside of ordinary image data (steganography). I'm not sure if the recompression will always remove everything (probably not). To avoid this recompression you can use jpegtran:
jpegtran -copy none image.jpg > newimage.jpg
Also, to avoid losing color profile (ICC metadata, which causes richer colors[citation needed]):
convert image.jpg profile.icm && convert image.jpg -strip -profile profile.icm newimage.jpg
You might ask yourself if these costs are noticeable or relevant in your case.
Another tool about steganography on images is steghide.
Other tools and notes
- mat2 (Metadata anonymization toolkit v2): Removes metadata from a lot of formats (
--list
). It's recommended by privacyguides.org. - Alternatives:
jhead
(only for JPEGs) and exiv2 (man; suggested on Wikipedia). - Metadata Cleaner: Desktop app to view and clean metadata in files (not only images).
- If you prefer Exiftool, you might find useful creating an alias to
exiftool -all= *.jpg && rm *original
, or with-overwrite_original
option. To remove only GPS data useexiftool -gps:all= -xmp:geotag= *.jpg
. Use an updated version: CVE-2021-22204. - WebP format:
webp
package provideswebpmux
command, which manage XMP/EXIF metadata and ICC profile. exifprobe
/exifgrep
: probe and report structure and metadata content of camera image files- For Android? Scrambled Exif, available on F-Droid (and Google Play).