file timestamp in image

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
hahu
Posts: 3
Joined: 2011-04-22T01:50:01-07:00
Authentication code: 8675308

file timestamp in image

Post by hahu »

hello,

how can I insert a time stamp (date & time) into an image? the exif information is NOT available. the file creation time stamp is needed.

johannes
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: file timestamp in image

Post by whugemann »

What kind of image format are you dealing with? JPEG? (Because you spoke of EXIF.)

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

Re: file timestamp in image

Post by Bonzo »

How are you running the code ? If via php you can get the file change time and there may be similar functions for other languages.
hahu
Posts: 3
Joined: 2011-04-22T01:50:01-07:00
Authentication code: 8675308

Re: file timestamp in image

Post by hahu »

hi.
thanks for your answers.
the image format is jpg - it's coming from an ftp upload from an IP cam.
it should be post-processed in linux - only from the command line.
johannes
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: file timestamp in image

Post by whugemann »

I wonder what you mean by "time stamp". Do you want to write it as text onto the image? (I first understood that you wanted to insert EXIF data or something. This is why I asked for the image format.)

If so, you will find many hints at http://www.imagemagick.org/Usage/annotating, and http://www.imagemagick.org/Usage/windows/#single gives an example how you write a time stamp read from the EXIF data onto an image.

Basically, you need your OS to write the output of the Date command into a variable and then use it in the IM command.

Wolfgang Hugemann
Wolfgang Hugemann
hahu
Posts: 3
Joined: 2011-04-22T01:50:01-07:00
Authentication code: 8675308

Re: file timestamp in image

Post by hahu »

hi.

i finally managed to do what i wanted to do ...
thanks, anyway.

here is my solution:

#!/bin/sh
FILEDATE=$(stat testimage.jpg --printf=%y)
montage -geometry +0+0 -background white -label "$FILEDATE" testimage.jpg out.jpg

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

Re: file timestamp in image

Post by anthony »

Have a look at image annotation.
http://www.imagemagick.org/Usage/annotating/
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply