jpegtran Command to Remove Metadata from jpeg and jpg Image Files
I’ll introduce how to use the jpegtran command to remove metadata from .jpeg and .jpg image files.
JPEG images may contain Exif metadata that doesn’t affect the display, so we’ll remove this to optimize images without degrading quality.
brew install jpeg
To remove metadata with the jpegtran command, use the following options:
-copy none Remove all metadata from jpeg files
-optimize Optimize Huffman tables
-outfile Specify the output destination of the file
jpegtran -copy none -optimize -outfile /path/to/target.jpg /path/to/target.jpg
find /path/to/dir/ -name "*.jpg" -type f -exec jpegtran -copy none -optimize -outfile {} {} \\;
That’s all from the Gemba.