Add date to photos

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
Elapido
Posts: 42
Joined: 2011-06-10T14:27:28-07:00
Authentication code: 8675308

Add date to photos

Post by Elapido »

Hello. Could you tell me how to add text in the bottom right corner of a series of jpgs indicating the date of the photo (the date in which it was taken, or the date in which the file was created). I'd like white small font, with a black outline. Is this possible? Thanx.
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Add date to photos

Post by Bonzo »

Image

Yes it can be done and I think Anthony posted a while back about how to get the date into the command with resorting to reading it into a variable.

Otherwise get the date into a variable using identify and use that in the command; as you do not say how you will be using the code here is a batch script version:

Code: Select all

:: Use the ImageMagick identify command to set the variable DateTime to equal the Date and Time from the photo EXIF data
 FOR /F %%x IN ('identify -format "%%[EXIF:DateTime]" %INPUTFILE%') DO SET DateTime=%%x
 
:: Add the date the photo was taken to the image 
convert %1 -pointsize 20 -fill black -gravity northwest ^
 -annotate +0+0 "Date: %DateTime%" "%~p1date_%~n1.jpg"
Elapido
Posts: 42
Joined: 2011-06-10T14:27:28-07:00
Authentication code: 8675308

Re: Add date to photos

Post by Elapido »

Thankyou. What's the difference between that script and this one I've found?

BTW, in this example, the modified files are stored in a different folder but the names are wrong and have no extension. How can I fix it?

convert fotosin\*.jpg -font Arial -pointsize 32 -fill white -annotate +30+50 %[exif:DateTimeOriginal] \fotosout
Post Reply