I know there are several Windows programs to do this, and Photoshop has a "Save for Web" option which does this, but I want a command line or batch processing option for this. Any thoughts?

  • Have you tried Automator, maybe with third party actions (e.g. Pixelmator?)?
    – Daniel Beck
    Commented Sep 14, 2011 at 14:15

4 Answers 4


Have a look at Imagemagick. Its -strip option clear an image of any profiles and comments.

convert orig.jpg -strip result.jpg


mogrify -strip orig.jpg

Here's more info on photo handling with Imagemagick.

  • 1
    I did not want to spend a lot of time and although was interested to work with Imagemagick, spend 10+ minutes configuring it. I tried SmallImage and got what I wanted in 2 min.
    – user200507
    Commented Feb 19, 2013 at 13:35
  • 4
    @user200507 To quote the OP, "I want a command line option, or a batch processing option for this." I stand by Imagemagick as being the best at this.
    – Ellesa
    Commented Feb 26, 2013 at 6:26
  • Imagemagick's strip also stripped the green and blue channels from my semi-transparent red circle, leaving a no-metadata opaque red circle.
    – psoft
    Commented Mar 23, 2017 at 17:06
  • WARNING! mogrify did not remove the kMDItemWhereFroms = ( metadata for me! (convert did, though). It was extremely damning metadata too, because it included my full name and even that I had airdropped the photo from my iPhone. You can view this metadata with mdls.
    – ijoseph
    Commented Nov 27, 2022 at 0:10

I use macOS — currently 11.1 (Big Sur) — and I like to use ExifTool for batch metadata operations like this. Have used it from Mac OS X 10.6 onwards and even on different flavors of Linux such as Ubuntu and it works great.

As far as bulk scripting goes, I use this very simply Bash script that uses find to wipe all metadata from images; in this case JPEG (.jpg) images:

find 'Path/To/The/Images' -type f -name '*.jpg' |\
  while read FILENAME
    exiftool -all= -overwrite_original_in_place "${FILENAME}"

To use the script just change the 'Path/To/The/Images' to match your actual image file directory path; it can be a full path or relative and in this case it is relative. And you can change '*.jpg' to match whatever file extension you wish to act on or even set it to '*' to blindly process all files. I usually deal with JPEGs thus the .jpg extension in this small example script.

And the core magic to that script is the actual exiftool command which can be further simplified to this:

exiftool -all= -overwrite_original_in_place image_filename.jpg

The -all= is what wipes the metadata by setting all metadata fields to the value that equals nothing. The -overwrite_original_in_place will overwrite the actual image. It does not reprocess the image past reading the file, acting on the metadata and writing it back to the system. Without that flag exiftool will copy the original file with an extension that has _original appended to it; so in this case it would be image_filename.jpg_original. And the final parameter is simply the filename you want to act on.

  • 3
    exiftool -all= will remove the ICC color profile, which is now more of a problem than it used to be because some iPhones use a P3 profile while the default (for images without a profile) remains sRGB. I recommend exiftool -exif:all= -iptc:all= -time:all= instead.
    – Old Pro
    Commented Jan 17, 2022 at 21:25

The exiv2 tool (installable using homebrew) provides a quick and simple way to remove the EXIF information from one or more files e.g.:

exiv2 rm myfile1.jpg myfile1.jpg  

actually nconvert strips far more from the jpgs


nconvert.exe -rmeta -rexifthumb -o small.jpg big.jpg

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .