Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove all metadata from an image on the command line

So I used exiftool -all= command line tool to remove the metadata from an image. However, when I print the metadata of the resulting image, I get this:

$ exiftool myimage.jpg
ExifTool Version Number         : 11.30
File Name                       : myimage.jpg
Directory                       : out
File Size                       : 2.8 MB
File Modification Date/Time     : 2019:05:16 03:34:02-07:00
File Access Date/Time           : 2019:05:16 03:34:02-07:00
File Inode Change Date/Time     : 2019:05:16 03:34:02-07:00
File Permissions                : rw-r--r--
File Type                       : JPEG
File Type Extension             : jpg
MIME Type                       : image/jpeg
DCT Encode Version              : 100
APP14 Flags 0                   : [14]
APP14 Flags 1                   : (none)
Color Transform                 : YCbCr
Image Width                     : 3729
Image Height                    : 2246
Encoding Process                : Baseline DCT, Huffman coding
Bits Per Sample                 : 8
Color Components                : 3
Y Cb Cr Sub Sampling            : YCbCr4:4:4 (1 1)
Image Size                      : 3729x2246
Megapixels                      : 8.4

I am wondering a few things:

  1. If it is required at some level to have all of this (albeit minimal) metadata. That is, I'm wondering if we could get even more minimal and really remove all metadata.
  2. If we can't remove all the metadata that remains, I'm wondering if I can at least remove the first 3 attributes (ExifTool Version Number, File Name, and Directory).

If any of this is possible, wondering what tool (preferrably command-line tool) could accomplish this.

like image 301
Lokasa Mawati Avatar asked Mar 04 '23 23:03

Lokasa Mawati


1 Answers

Almost all that remaining data is not metadata embedded in the file. They are properties of the image or the underlying OS. Or even in the case of ExifTool Version Number, the version of exiftool you are running. The '-g' and '-G' options can show you which group each tag comes from; in particular, group families 0 and 1 can be used to see the tags that come from ExifTool and file attributes, as well as those embedded in the image file itself.

The items such as permissions, file name, directory, and the time stamps are taken directly from the underlying OS. Those are properties of every single file on the drive. Without them, the file itself does not exist.

The file/Mime type entries are properties of the file that exiftool has created when it figured out what kind of file it is.

Except for the APP14 entries, the rest are data about the image itself. How it is encoded, the format of the encoding blocks, the size of the image, etc.

The only thing that is embedded in this image is the APP14 block. This block contains no data that can identify the origin of the image. But there is a chance that removing it will significantly alter the colors of the image (see this post). It can be removed by adding -Adobe:All= to the command.

like image 92
StarGeek Avatar answered Mar 06 '23 12:03

StarGeek