Page 1 of 1

Stamp All Images in a Folder with Date Taken (EXIF)

Posted: 2012-04-04T03:21:43-07:00
by MikeCompton
Hi all, newbie here

I have seen this thread viewtopic.php?f=1&t=19423

and I have seen Bonzo's useful examplke batch file scripts http://www.rubblewebs.co.uk/imagemagick/batch.php

but i have struggled and failed!!

Please can someone give me some code for a batch file that will write the date take to the bottom right hand corner of all images in a specified folder?

Re: Stamp All Images in a Folder with Date Taken (EXIF)

Posted: 2012-04-04T05:27:51-07:00
by whugemann

Re: Stamp All Images in a Folder with Date Taken (EXIF)

Posted: 2012-04-04T20:10:34-07:00
by anthony
Something like...

Code: Select all

    mogrify  -gravity SouthEast -annotate +5+5 '%[EXIF:DateTime]'  *.jpg
DANGER, the above replaces images. add a -path to specify a output directory for the chnaged images, and make sure you have backups!

See Mogrify
http://www.imagemagick.org/Usage/basics/#mogrify

Also see "jhead" program whcih can adjust dates and times in image files without touching the actual image data
http://www.sentex.net/~mwandel/jhead/

Re: Stamp All Images in a Folder with Date Taken (EXIF)

Posted: 2012-04-16T04:59:43-07:00
by MikeCompton
anthony wrote:Something like...

Code: Select all

    mogrify  -gravity SouthEast -annotate +5+5 '%[EXIF:DateTime]'  *.jpg
That doesnt work in a batch file because it is treated as a system variable it would appear, is there a workaround for that?

The command that is run is:

Code: Select all

    mogrify  -gravity SouthEast -annotate +5+5 'DateTime]'  *.jpg

Re: Stamp All Images in a Folder with Date Taken (EXIF)

Posted: 2012-04-16T07:39:59-07:00
by Bonzo
You need to escape the % with another % in a batch file so use '%%[EXIF:DateTime]'

I think there was a similar post about this a couple of weeks ago.

Thanks for the comment about my website :D

Re: Stamp All Images in a Folder with Date Taken (EXIF)

Posted: 2012-04-16T20:11:22-07:00
by anthony
You are using DOS scripts, which requires the '%' to be escaped by doubling EG '%%'.

See IM Examples, Windows Usage, DOS
http://www.imagemagick.org/Usage/windows/#dos

You also need to use double quotes " instead of single quotes '


DOS is just a different 'shell' or 'scripting language', as is VB, PHP, Perl, Ruby. Each has its own specific requirements!