Adding EXIF headers to old images from pre-EXIF digital cameras

PixoulPixoul Registered Users Posts: 97 Big grins
edited March 4, 2007 in Finishing School
After my little Lightroom FUBAR I've finally decided to give it a second go. This time I opted to inject metadata into all my old images from pre-EXIF digital cameras like the Olympus D-620 L. This will also work for scanned JPEG images.

The following script was written for Mac OS X but will work on any UNIX with the proper tools installed. It should also run on Windows under Cygwin.

This script will modify all images in the current directory without creating backups, so make sure you run it on a copy of the directory. It will create an EXIF header using the file creation date as the EXIF timestamp as well as inject the Manufacturer and Model you specify in the script. Create a separate script for each camera. :)

Warning: Do not run this script on images with EXIF data! It will nuke any EXIF data currently in the file!
Conespooge:~/Bin sean$ cat mkexif-olympus.sh 
#!/bin/sh

MANUFACTURER="Olympus"
MODEL="Olympus D-620 L"

for jpgfile in *jpg; do
    jhead -mkexif $jpgfile
    exif --ifd=0 --tag=0x010f --set-value="$MANUFACTURER" $jpgfile -o $jpgfile
    exif --ifd=0 --tag=0x0110 --set-value="$MODEL" $jpgfile -o $jpgfile
done

Prerequisites: jhead, exif
Conespooge:~ sean$ sudo port info exif
exif 0.6.9, graphics/exif (Variants: universal)
http://libexif.sourceforge.net/

Command line utility to read, write, modify and display EXIF data found in digital image files written by digital cameras.

Build Dependencies: pkgconfig
Library Dependencies: libexif, popt
Platforms: darwin
Maintainers: nomaintainer@macports.org
Conespooge:~ sean$ sudo port info jhead
jhead 2.7, graphics/jhead (Variants: universal)
http://www.sentex.net/~mwandel/jhead/

jhead is used to display and manipulate data contained in the Exif header of jpeg images from digital cameras. By default, jhead displays the more useful camera settings from the file in a user friendly format. jhead can also be used to manipulate some aspects of the image relating to jpeg and Exif headers, such as changing the internal timestamps, removing the thumbnail, or transferring Exif headers back into edited images after graphical editors deleted the exif header. jhead can also be used to launch other programs, similar in style to the UNIX find command, but much simpler.

Platforms: darwin
Maintainers: simon@cotsworth.com
Conespooge:~ sean$
Sign In or Register to comment.