imprint Exif DateTime on a jpeg?

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
Leeoniya

imprint Exif DateTime on a jpeg?

Post by Leeoniya »

Code: Select all

mogrify -density 300 -font Arial -pointsize 16 -stroke white -fill white -gravity SouthEast -draw "text 100,100 '%[EXIF:DateTimeOriginal]'" stampme.jpg
using

Code: Select all

%[EXIF:DateTime]
doesnt work either

can someone tell me what i'm doing wrong?

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

Re: imprint Exif DateTime on a jpeg?

Post by Bonzo »

Try something like this:

Code: Select all

mogrify -font verdana.ttf -pointsize 16 -draw \"gravity SouthWest fill white text 0,0 '%[EXIF:DateTimeOriginal]'\" sunflower.jpg
NOTE:
1/ I have used a font I have uploaded to the same folder verdana.ttf
2/ Mogrify will overwrite the original image.
3/ Text 0,0 will not offset the text from the position stated in gravity; if you want it moved add a value to 0,0.
Leeoniya

Re: imprint Exif DateTime on a jpeg?

Post by Leeoniya »

this is in my stamp.cmd file

Code: Select all

mogrify -font Arial -pointsize 50 -stroke white -fill white -gravity SouthEast -draw "text 100,100 '%[EXIF:DateTime]'" -density 300 print.jpg
when i go into command prompt, and type stamp.cmd....it shows as the following:

Code: Select all

mogrify -font Arial -pointsize 50 -stroke white -fill white -gravity SouthEast -draw "text 100,100 'DateTime]'" -density 300 print.jpg
it seems to strip the "%[EXIF:" and actually imprints the text "DateTime]" on the picture.

??
Leon
el_supremo
Posts: 1015
Joined: 2005-03-21T21:16:57-07:00

Re: imprint Exif DateTime on a jpeg?

Post by el_supremo »

If you are using Windows, then the % is probably being interpreted as introducing a script variable.
Try using a double percent - %%[EXIF:Datetime]

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

Re: imprint Exif DateTime on a jpeg?

Post by anthony »

From IM Examples,
Drawing Special Characters in the Text String
About Percent Characters
http://www.imagemagick.org/Usage/draw/#percent
Up until IM version 6.2.4, the '%' character was used as an escape character to include extra image information in the drawn text string. This is no longer the case as such escapes were confusing and incorrect when SVG images also tried to draw percent characters.
The solution is to use -annotate which does understand % escapes, and was added for that reason. It also does NOT have quote within quotes issues.

See Annotate - Text Drawing Operator
http://www.imagemagick.org/Usage/text/#annotate
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply