19

the title says it all. is there a tool?

I installed ExifTool, but can't find a way to remove all at once with one command.

21
exiftool -all= inputfile

The latest version of exiftool supports most file formats.

Output:

  1. If the input file contained metadata, it removes the metadata and overwrites inputfile, but saves a copy of the original as inputfile_original in the same folder.
  2. If the input file did not contain metadata, it performs no changes.

There are options in ExifTool to delete the original file: -overwrite_original and -overwrite_original_in_place.

5
  • 1
    Easy to make a mistake, do note the = – Tero Lahtinen Jul 10 '19 at 15:26
  • Be careful, this only hides data and does not delete it: askubuntu.com/questions/308250/… – baptx Apr 14 at 9:55
  • @baptx regarding PDF files, that is. – jarno Apr 14 at 21:17
  • @jarno indeed, at least for PDF files it was not enough but maybe there are also other file formats where using exiftool alone is not enough. – baptx Apr 15 at 10:11
  • @baptx, yes, hard to know. – jarno Apr 15 at 18:34
9

The Metadata anonymisation toolkit would do the trick for you. It has a GUI as well.

After Enabling the Universe Repository you can install it with:

sudo apt-get install mat
4
  • Doesn't support PDF files. – Foreever Apr 29 '19 at 8:20
  • 1
    currently apt install mat actually installs the mat2 command. Here's its canonical repository. It's easy to use, just mat2 foo.jpg. – tedder42 Feb 7 at 18:40
  • @Foreever it supports PDF files but compared to the combination of exiftool / qpdf, it does the PDF export as an image, which is less nice / accessible than a PDF that contains text that you can copy-paste. Maybe they do this on purpose so people cannot guess the date / software version used based on the PDF structure. – baptx Apr 14 at 10:31
  • I asked the author of mat2, he said it is possible to use text instead of images with the lightweight mode (-L option: 0xacab.org/jvoisin/mat2#notes-about-the-lightweight-mode) but it will not clean metadata of embedded resources like images (0xacab.org/jvoisin/mat2/-/blob/master/doc/…). – baptx 5 hours ago
7

Yes, there is a tool to remove metadata called exiv2.

Usage: exiv2 rm /path/to/location/files

2
  • 2
    thanks for the answer. but thats only for images, right? – aaaa Jun 14 '13 at 17:10
  • @aaaa yes my friend. – rɑːdʒɑ Jun 14 '13 at 17:37
4

You can use Metadata Extraction Tool

The Metadata Extract Tool includes a number of 'adapters' that extract metadata from specific file types. Extractors are currently provided for:

  • Images: BMP, GIF, JPEG and TIFF.
  • Office documents: MS Word (version 2, 6), Word Perfect, Open Office (version 1), MS Works, MS Excel, MS PowerPoint, and PDF.
  • Audio and Video: WAV, MP3 (normal and with ID3Tags), BFW, FLAC.
  • Markup languages: HTML and XML.
  • Internet files: ARC

If a file type is unknown the tool applies a generic adapter, which extracts data that the host system 'knows' about any given file (such as size, file name, and date created).

For more information, and to download visit Metadata Extraction Tool

Source:Metadata Extraction Tool

1
  • 1
    This program seems to only read the metadata, not remove it. – Håkon A. Hjortland Jul 30 '17 at 5:18
4

First, install exiftool using this command:

sudo apt-get install libimage-exiftool-perl

Then, go into the directory with the JPEG files. If you want to remove metadata from every file in the directory, use

exiftool -all= *.jpg

For single file, use

exiftool -all= <filename>.jpg
4
  • This doesn't work for mp3 files – baxx Jan 11 '19 at 17:43
  • @baxx OP does not mentioned to use this with .mp3 files – Hassaan Jan 11 '19 at 17:47
  • 2
    mp3 is a common file type that uses meta data and it's likely that someone will find this post as a result of searching ( I did ) – baxx Jan 11 '19 at 17:52
  • Be careful, like the other answer, this only hides data and does not delete it: askubuntu.com/questions/308250/… – baptx Apr 14 at 10:08
1

When using the command exiftool -all= inputfile shared here on PDF files, I got this message:

Warning: [minor] ExifTool PDF edits are reversible. Deleted tags may be recovered!

And by looking for the error message on a search engine, I found https://exiftool.org/forum/index.php?topic=4722.0 with a link to https://exiftool.org/TagNames/PDF.html that mentions:

All metadata edits are reversible. While this would normally be considered an advantage, it is a potential security problem because old information is never actually deleted from the file. (However, after running ExifTool the old information may be removed permanently using the "qpdf" utility with this command: "qpdf --linearize in.pdf out.pdf".)

So if you really want to delete the metadata from PDF files so it cannot be recovered instead of just hiding it, you should use the command qpdf --linearize in.pdf out.pdf afterwards.

If you want to try to recover the hidden / removed metadata from PDF files, the man page https://exiftool.org/exiftool_pod.html explains how to dot it:

Changes to PDF files by ExifTool are reversible (by deleting the update with -PDF-update:all=) because the original information is never actually deleted from the file. So ExifTool alone may not be used to securely edit metadata in PDF files.

So the command will be something like exiftool -PDF-update:all= inputfile. You can then check the properties of the file in your PDF viewer to see if the metadata is restored.

Note: this solution does not clean metadata of embedded resources like images unlike the tool mat2 shared in another answer (except when using lightweight mode: https://0xacab.org/jvoisin/mat2/-/blob/master/doc/implementation_notes.md#lightweight-cleaning-mode). But images metadata is not always present in PDF files. For example to do a PDF export with LibreOffice Writer and keep metadata, we need to disable "Reduce image resolution" (an answer also mentioned that we need to enable "Lossless compression" but I did not need it: https://security.stackexchange.com/questions/185507/does-embedding-images-in-pdf-retain-metadata). Then I was able to save the image with metadata from the PDF file with LibreOffice Draw and view the metadata with GIMP in the menu "Image -> Metadata -> View Metadata".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.