Wren Linux

wren-linux / extras / metadata-cleaner.sh

#!/bin/bash
# Metadata Cleaner (the graphical program Tails ships) removes hidden
# metadata (GPS position, camera model, author names, edit history) from
# photos, PDFs, office documents, audio and video, before you share them.
# It is built on mat2, which comes with it and gives the mat2 command.
# From Debian.
# Usage: bash metadata-cleaner.sh [--remove | --manual]
# summary: Metadata Cleaner (and the mat2 command)
# security: most
# category: files
# status: apt:metadata-cleaner apt:mat2
. "$(dirname -- "${BASH_SOURCE[0]}")/../lib.sh"
if [ "${1:-}" = --manual ]; then print_manual; exit; fi
need_user

if [ "${1:-}" = --remove ]; then
    apt_purge metadata-cleaner mat2
    exit
fi

say "Installing Metadata Cleaner"
apt_install metadata-cleaner mat2

cat <<'EOF'

    The window: metadata-cleaner   (or Super+d). Add files, look at what
    they carry, then clean them. It does what the mat2 command does:

    How to use mat2 in a terminal:
      mat2 --show photo.jpg          list the metadata it finds (removes nothing)
      mat2 photo.jpg                 write photo.cleaned.jpg without metadata
      mat2 *.jpg report.pdf          clean several files at once
      mat2 --inplace photo.jpg       clean the file itself, no copy kept
      mat2 --lightweight report.pdf  gentler: a PDF keeps selectable text,
                                     but some metadata may stay
      mat2 --list                    the file types it handles

    A normal clean turns PDF pages into images, so the text can't be
    selected any more; that's how it makes sure nothing hides in them.
    "--show" finding nothing doesn't prove a file is clean: clean it anyway.
EOF