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

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
MikeCompton
Posts: 2
Joined: 2012-04-04T03:14:36-07:00
Authentication code: 8675308

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

Post by MikeCompton » 2012-04-04T03:21:43-07:00

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?

User avatar
whugemann
Posts: 286
Joined: 2011-03-28T07:11:31-07:00
Authentication code: 8675308
Location: Münster, Germany 52°N,7.6°E

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

Post by whugemann » 2012-04-04T05:27:51-07:00

Wolfgang Hugemann

User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

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

Post by anthony » 2012-04-04T20:10:34-07:00

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/
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/

MikeCompton
Posts: 2
Joined: 2012-04-04T03:14:36-07:00
Authentication code: 8675308

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

Post by MikeCompton » 2012-04-16T04:59:43-07:00

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

Bonzo
Posts: 2970
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

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

Post by Bonzo » 2012-04-16T07:39:59-07:00

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

User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

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

Post by anthony » 2012-04-16T20:11:22-07:00

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!
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/

Post Reply