Quantcast
Channel: How can I read and remove meta (exif) data from my photos using the command line? - Ask Ubuntu
Viewing all articles
Browse latest Browse all 6

Answer by Pablo Bianchi for How can I read and remove meta (exif) data from my photos using the command line?

$
0
0

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:

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

See also


Viewing all articles
Browse latest Browse all 6

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>