Exiftool-Image Processing

From richud.com
Jump to navigation Jump to search


exiftool, the worlds most complicated command line tool!

rename files using exif data

exiftool -m -P '-FileName<${Imagedescription;}%-c $DateTimeOriginal.tif' -d %Y somefile.tif

-m fill in missing with nothing by default, to change so you dont end up with blanks see below altering the MissingTagValue

-P preserve the time of the file

'; inside braces' passes the value through tr to strip nasty characters like slashes [broken in v 9.04-1 included in Ubuntu 13.04, need latest version binary.]

%-c if output name is duplicated it appends -1 -2 etc.

-d %Y formats date in output name as just year


To loop though sub dirs (couldn't face working out more syntax of exiftool to do it!)

find ./ -iname "*.tif" -exec /home/xxxxx/Image-ExifTool-9.37/exiftool -m -P '-FileName<${Imagedescription;}%-c $DateTimeOriginal.tif' -d %Y {} \;

Using -m to fill in any missing tag values (variables from exif data) , create "~/.ExifTool_config" containing;

%Image::ExifTool::UserDefined::Options = (
    MissingTagValue => 'MISSING',
);

You then get output like this if the datetimeoriginal is missing. (used it to put a historical date on slide scanning scans)

"Text and more text, Sometext MISSING.tif"