4

For privacy concerns, I want to remove all metadata from a document (e.g. pdf, jpg, docx, …). Metadata in general is additional information stored somehow apart the actual content like:

  • Used Software
  • Used Operating System
  • Time and sometimes place
  • Camera model, used gear… (photographs, see Exif)

How do I reliably strip all metadata from my pdf, jpg, docx, etc., files?

3

2 Answers 2

6

MAT

Have a look at MAT (Metadata Anonymisation Toolkit)! It comes from the TOR-people and as standard on Tails—a privacy and anonymity focused live OS.

Since it's kind of a wrapper around exiftool, it supports more file formats that exiftool alone.

By now, they are:

  • Portable Network Graphics (.png)
  • JPEG (.jpg, .jpeg, …)
  • TIFF (.tif, tiff, …)
  • Open Documents (.odt, .odx, .ods, …)
  • Office OpenXml (.docx, .pptx, .xlsx, …)
  • Portable Document Fileformat (.pdf)
  • Tape ARchives (.tar, .tar.bz2, …)
  • MPEG AUdio (.mp3, .mp2, .mp1, …)
  • Ogg Vorbis (.ogg, …)
  • Free Lossless Audio Codec (.flac)
  • Torrent (.torrent)

For some more details, have a look at this paper.

BEWARE

“Mat only removes standard metadata from your files, it does not:

  • anonymise their content
  • handle watermarking
  • handle steganography
  • any overly customized metadata field/system (→jpg,zip)

If you really want to be anonymous, use formats that do not contain any metadata, or better: use plain-text.

And most important, be careful: every format can be watermarked, even plain text (e.g. the SNOW project)!

You can also print out a copy of the documents, re-scan them, and pass it to the MAT; but be careful to securely shred your printout and not leave traces in your printer’s/scanner’s memory.” (taken from MAT-website)

JPEG

Comments and the standard Exif-/IPTC-/XMP-tags are being deleted. There might be proprietary non-standard tags (like Canon Raw tags) MAT does not touch. These could be included by e.g. proprietary RAW → JPEG conversion tools.

ZIP

MAT does not alter the content of the archive. If a tool creates additional files containing metadata within the archive, they will not be touched.

Installation

Ubuntu 12.10 and above

Since Ubuntu 12.10 it's in the standard repository universe.

sudo apt install mat

Below Ubuntu 12.10

For older versions of Ubuntu, it has to be installed by hand. The dependencies are:

  • gir1.2-poppler-0.18
  • libimage-exiftool-perl (universe)
  • python2.7
  • python-gi-cairo
  • python-mutagen
  • python-pdfrw (universe)

Install them via:

sudo apt-get install gir1.2-poppler-0.18 libimage-exiftool-perl python2.7 python-gi-cairo python-mutagen python-pdfrw

Then get MAT here (e.g. mat-0.6.1.tar.xz). If you want verify your download with GnuPG, get the .asc file as well.

To check it, import the key given at the bottom of the page e.g. via

gpg --search-keys 0x04D041E8171901CC

and check with:

gpg --verify mat-0.6.1.tar.xz.asc  mat-0.6.1.tar.xz

The output should be something like

gpg: Signature made Sun 03 Jan 2016 09:02:29 PM CET using RSA key ID 171901CC
gpg: Good signature from "Julien (jvoisin) Voisin <[email protected]>" [unknown]
gpg:                 aka "Julien (jvoisin) Voisin <[email protected]>" [unknown]
gpg:                 aka "Julien (jvoisin) Voisin <[email protected]>" [unknown]
gpg: WARNING: This key is not certified with a trusted signature!
gpg:          There is no indication that the signature belongs to the owner.
Primary key fingerprint: 9FCD EE9E 1A38 1F31 1EA6  2A74 04D0 41E8 1719 01CC

Extract and install via

tar xvfJ mat-0.6.1.tar.xz
cd mat-0.6.1
sudo python2 setup.py install

Debian users find it in the testing-repo, Arch users in AUR.

If everything went fine, you have the console tool mat as well as the gui mat-gui.

1

Since I had to look this up multiple times now, here is the solution that worked for me for pdfs:

pdftk myfile.pdf cat 1-end output clean-myfile.pdf

This here also looks sensible (but I did not test it):

qpdf --pages myfile.pdf 1-z -- --empty clean-myfile.pdf

both answers are taken from https://gist.github.com/hubgit/6078384#gistcomment-2004771 .

1
  • 1
    Did you even check if the pdftk output is clean? A simple strings clean-myfile.pdf clearly shows pdftk puts its own trash in there: /Creator (pdftk-java ....
    – thalisk
    Apr 29, 2022 at 8:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .