Delete metadata of an image file by using ExifTool
Abstract
Delete metadata of an image file by using ExifTool on Ubuntu 12.04.
The following command is useful to sanitize images before uploading and downloaded images.
Install ExifTool
$ wget http://www.sno.phy.queensu.ca/~phil/exiftool/Image-ExifTool-9.60.tar.gz $ tar xf Image-ExifTool-9.60.tar.gz $ cd Image-ExifTool-9.60/ $ perl Makefile.PL $ make test $ sudo make install $ cd .. $ rm -rf Image-ExifTool-9.60 $ rm Image-ExifTool-9.60.tar.gz
Command
# Delete metadata of an image file. $ exiftool -all= input_image.jpg -out output_image.jpg
Example
Use AcerCE-5330.jpg in Acer.tar.gz downloaded from sample images as an example.
# Before deleting metadata. $ exiftool AcerCE-5330.jpg ExifTool Version Number : 9.60 File Name : AcerCE-5330.jpg Directory : . File Size : 22 kB File Modification Date/Time : yyyy:MM:dd HH:mm:ss File Access Date/Time : yyyy:MM:dd HH:mm:ss File Inode Change Date/Time : yyyy:MM:dd HH:mm:ss File Permissions : rw-r--r-- File Type : JPEG MIME Type : image/jpeg Exif Byte Order : Little-endian (Intel, II) Image Description : ACER Make : ACER Camera Model Name : CE-5330 Orientation : Horizontal (normal) X Resolution : 72 Y Resolution : 72 Resolution Unit : inches Software : V1.00 Modify Date : 2009:10:10 22:58:22 Y Cb Cr Positioning : Co-sited Exposure Time : 1/30 F Number : 2.8 Exposure Program : Program AE ISO : 100 ... Circle Of Confusion : 0.005 mm Field Of View : 53.8 deg Focal Length : 5.4 mm (35 mm equivalent: 35.5 mm) Hyperfocal Distance : 2.28 m Light Value : 7.9 # Delete metadata and output as AcerCE-5330.out.jpg. $ exiftool -all= AcerCE-5330.jpg -o AcerCE-5330.out.jpg 1 image files created # After deleting metadata. $ exiftool AcerCE-5330.out.jpg ExifTool Version Number : 9.60 File Name : AcerCE-5330.out.jpg Directory : . File Size : 251 bytes File Modification Date/Time : yyyy:MM:dd HH:mm:ss File Access Date/Time : yyyy:MM:dd HH:mm:ss File Inode Change Date/Time : yyyy:MM:dd HH:mm:ss File Permissions : rw-rw-r-- File Type : JPEG MIME Type : image/jpeg Image Width : 8 Image Height : 8 Encoding Process : Baseline DCT, Huffman coding Bits Per Sample : 8 Color Components : 3 Y Cb Cr Sub Sampling : YCbCr4:2:0 (2 2) Image Size : 8x8