How can I recursively remove the EXIF info from several thousand JPG files?
4 Answers
The other ExifTool suggestions are great if you want to remove or change specific sections. But if you want to just remove all of the metadata completely, use this (from the man page):
exiftool -all= dst.jpg
Delete all meta information from an image.
You could also use jhead, with the -de flag:
-de Delete the Exif header entirely. Leaves other metadata
sections intact.
Note that in both cases, EXIF is only one type of metadata. Other metadata sections may be present, and depending on what you want to do, both of these programs have different options for preserving some or removing it all. For example, jhead -purejpg
strips all information not needed for rendering the image.
The EXIF handling tool exiv2
has a command for deleting EXIF data:
exiv2 rm image.jpg
removes all EXIF data from the image.
To remove EXIF data from all JPEG images in the current directory, use
exiv2 rm *.jpg
To remove EXIF data from all JPEG images in the current directory, and all subdirectories of it recursively, use:
find . -type f -iname '*.jpg' | xargs exiv2 rm
It is a good idea to test the command before.
To see which files are found:
find . -type f -iname '*.jpg' | less
To see which commands will be executed:
find . -type f -iname '*.jpg' | xargs echo exiv2 rm | less
Note the echo
inserted before exiv2
to print the command, instead of running it.
You should look at some opensource tools like exiftool. There is a lot of option (for exif, xmp, iptc).
exiftool -overwrite_original \
-xmp:Creator='votre nom' \
-xmp:WebStatement='http://creativecommons.org/licenses/by-nc-nd/3.0/' \
-xmp:Rights='Copyright votre nom. This work is licensed under a Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 License.' \
-iptc:By-line='votre nom' \
-iptc:CopyrightNotice='Copyright votre nom. This work is licensed under a Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 License.' \
-exif:Artist='votre nom' \
-exif:Copyright='Copyright votre nom. This work is licensed under a Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 License.' \
votre_fichier.jpg
The only thing you should do next is to write a tiny script that lists your files (jpg) and does the stuff. To remove the content of a field you'll have to set it to " ^" ; like the following example:
-Software= ^
-ModifyDate= ^
-CreatorTool= ^
-MetadataDate= ^
-Rating= ^
-ImageNumber= ^
-WhiteBalance= ^
-Temperature= ^
-Tint= ^
-IncrementalTemperature= ^
-IncrementalTint= ^
-Exposure= ^
-Shadows= ^
-Brightness= ^
-Contrast= ^
-Saturation= ^
-Sharpness= ^
-LuminanceSmoothing= ^
-ColorNoiseReduction= ^
-ChromaticAberrationR= ^
-ChromaticAberrationB= ^
-VignetteAmount= ^
-VignetteMidpoint= ^
-ShadowTint= ^
-RedHue= ^
-RedSaturation= ^-GreenHue= ^
-GreenSaturation= ^
-BlueHue= ^
-BlueSaturation= ^
-FillLight= ^
-Vibrance= ^
-HighlightRecovery= ^
-Clarity= ^
-Defringe= ^
-HueAdjustmentRed= ^
-HueAdjustmentOrange= ^
-HueAdjustmentYellow= ^
-HueAdjustmentGreen= ^
-HueAdjustmentAqua= ^
-HueAdjustmentBlue= ^
-HueAdjustmentPurple= ^
-HueAdjustmentMagenta= ^
-SaturationAdjustmentRed= ^
-SaturationAdjustmentOrange= ^
-SaturationAdjustmentYellow= ^
-SaturationAdjustmentGreen= ^
-SaturationAdjustmentAqua= ^
-SaturationAdjustmentBlue= ^
-SaturationAdjustmentPurple= ^
-SaturationAdjustmentMagenta= ^
-LuminanceAdjustmentRed= ^
-LuminanceAdjustmentOrange= ^
-LuminanceAdjustmentYellow= ^
-LuminanceAdjustmentGreen= ^
-LuminanceAdjustmentAqua= ^
-LuminanceAdjustmentBlue= ^
-LuminanceAdjustmentPurple= ^
-LuminanceAdjustmentMagenta= ^
-SplitToningShadowHue= ^
-SplitToningShadowSaturation= ^
-SplitToningHighlightHue= ^
-SplitToningHighlightSaturation= ^
-SplitToningBalance= ^
-ParametricShadows= ^
-ParametricDarks= ^
-ParametricLights= ^
-ParametricHighlights= ^
-ParametricShadowSplit= ^
-ParametricMidtoneSplit= ^
-ParametricHighlightSplit= ^
-SharpenRadius= ^
-SharpenDetail= ^
-SharpenEdgeMasking= ^
-ConvertToGrayscale= ^
-ToneCurveName= ^
-CameraProfile= ^
-HasSettings= ^
-CropTop= ^
-CropLeft= ^
-CropBottom= ^
-CropRight= ^
-CropAngle= ^
-CropWidth= ^
-CropHeight= ^
-CropUnit= ^
-HasCrop= ^
-AlreadyApplied= ^
-ToneCurve= ^
-CameraProfile= ^
-ApplicationRecordVersion= ^
Vincent's suggestion of using exiftool is good. I suggest you write a script that accepts a single argument of a filename, and runs your desired strip functions on that. Then use find
to execute this script on your file set. The script would look something like this:
#!/bin/sh
exiftool -overwrite_original -ExifFieldName=^ [-MoreExifFieldNames=^] $1
Say you save this as /usr/local/bin/strip_exif.sh
, you could then call it by going to the folder that has your jpeg files like this:
find -type f -iname '*.jpg' -exec strip_exif.sh {} \;
Edit: After seeing mattdm's answer about the argument for striping all tags, I figure you can skip the script and just use the find like this:
find -type f -iname '*.jpg' -exec exiftool -all= {} \;