Table of Contents

Photo/Scan/Film Scan manipulation from the command-line

These are mainly tasks I do with my scanned files.

By using ImageMagick files can remain 48bits and preserve embedded ICC profiles. Note though that EXIF requires special care in some file formats (like TIFF).

Store digitalisation time

EXIF can store both the time of capture/shot (DateTimeOriginal) and the time of digitalisation (DateTimeDigitized). This uses the file modification date as the time of digitalisation. Will only remain correct if the file has not been modified (i.e. do this first) [Unix command-line]:

$ exiftool -P -overwrite_original -DateTimeDigitized=$(stat -c %y "FILE.TIF" | cut -d. -f1 |sed 's/-/:/g') FILE.TIF

Script:

#!/bin/bash

IN="$1"
[ "$IN" ] || exit 1

DateDig=$(stat -c %y "$IN" | cut -d. -f1 |sed 's/-/:/g')
exiftool -P -overwrite_original -DateTimeDigitized="$DateDig" "$IN"

Lossless compression in TIFF

ZIP compression is not supported by all programs but better than the more common LZW:

$ convert FILE.TIF -alpha off -compress zip -quality 100 FILE2.TIF

This discards any EXIF data! See below for how to copy it.

Note -quality here doesn't actually affect quality since this operation is lossless, but it increases the compression level slightly.

''-alpha off' drops the alpha channel (transparency) if there's one. Unedited scans shouldn't contain an alpha channel but this will depend on the programs involved. If present, dropping it will further reduce the filesize.

Copy EXIF between files

$ exiftool -P -overwrite_original -TagsFromFile SOURCE.TIF DEST.TIF

Invert negative

$ convert SOURCE.TIF -negate DEST.TIF

Workflow

My workflow with EPSON Scan is: