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 »

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: 289
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 »

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 »

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 »

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: 2971
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 »

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 »

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