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.
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It only takes a minute to sign up.
Sign up to join this communityexiftool -all= inputfile
The latest version of exiftool supports most file formats.
Output:
inputfile
, but saves a copy of the original as inputfile_original
in the same folder.There are options in ExifTool to delete the original file: -overwrite_original
and -overwrite_original_in_place
.
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
apt install mat
actually installs the mat2
command. Here's its canonical repository. It's easy to use, just mat2 foo.jpg
.
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
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
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 do 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".