Deleting metadata from files

jhead

You can use jhead [8], a small command-line program, to modify the Exif headers in JPEG files. Due to the software's considerable number of parameters, jhead requires a longer training period depending on your intended use. Because jhead can only handle JPEGs, you will get an error message if you call a file in any other format.

To display an image file's metadata, use the command:

jhead FILE

The application then lists the individual Exif tags in the terminal (Figure 6). To change the tags based on the parameters supported by the software, use the command:

jhead PARAMETER FILE
Figure 6: jhead deletes or modifies metadata in JPEG files only.

The individual parameters are revealed by calling jhead -h. To change the same Exif tag for multiple files located in a directory, you can also specify the file names using wildcards, resulting in jhead doing the job in one fell swoop.

mat2

A classic tool for removing metadata from file collections, the Metadata Anonymisation Toolkit 2 (mat2) [9] not only supports images and audio and video files, but it also supports PDF and Office file formats. This makes mat2 particularly suitable for users in sensitive areas, such as journalists or lawyers.

The command-line tool offers numerous options and parameters, which require some familiarization. However, a plugin for the Gnome file manager Nautilus lets you clean up groups of files at the command line even without knowing the syntax (Figure 7). To do this, you simply select the files to be cleaned and then right-click to call up a context menu in which you click the Remove metadata option.

Figure 7: You can use mat2 in the Gnome file manager Nautilus via a plugin.

Using the plugin, you can select files with a wide variety of formats; mat2 identifies the format and applies the correct routines to remove the metadata. During cleanup, the plugin also displays a progress bar at the top of the program window. In addition to the original file, which remains unprocessed, the cleaned file, which has the same name with cleaned appended, is created in the working directory.

The Tails security distribution ships mat2 with the Nautilus plugin pre-configured.

Metadata Cleaner

Only a few distributions currently have Metadata Cleaner [10] in their repositories. Native binaries are available for Arch Linux, Debian, and Ubuntu and their descendants; a Flatpak and the Python source code are also available.

After installation and first startup, Metadata Cleaner loads with a visually modern and functionally spartan window: Metadata Cleaner has no conventional menubar or buttonbar. Instead, the GTK-based application follows the Gnome operating principle and integrates all controls of interest in the titlebar (Figure 8).

Figure 8: Metadata Cleaner stands out due to its brightly colored interface.

The Add Files button in the top left corner takes you to a file manager where you can select the image files to be processed. Metadata Cleaner then displays them in a list, with the number of identified Exif tags highlighted in red in a column on the right. Clicking on the rightmost arrow after each file icon opens a detailed display of the metadata embedded in the respective image file. The arrow pointing to the left in the titlebar takes you back to the file display.

To remove the metadata from all of the loaded files, simply press the big red Clean button bottom right in the program window. Metadata Cleaner will suggest creating a backup copy and then it will delete all metadata it finds without further ado. The application does not automatically create any backup copies of the originals, so the metadata cannot be reconstructed later.

If you click on the gear icon to the left of the Clean button, a small dialog opens in which you can switch on a Superficial cleanup via a slider. This mode does not completely remove the metadata from the respective file, but tries to preserve functionally relevant metadata. The Superficial cleanup is best suited for file formats such as PDF, where you can also make changes. Modifications such as text changes in a PDF or image compression may be controlled by the metadata and will be lost if the meta tags are missing. Consequently, you should not delete all the metadata for these types of file formats. The slider effects all files stored in the program window. Cleaning up the files takes some time, depending on the number.

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

comments powered by Disqus
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters

Support Our Work

Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.

Learn More

News