LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
LinkBack Search this Thread
Old 09-11-2007, 04:41 PM   #1
FSHero
LQ Newbie
 
Registered: Jul 2007
Distribution: Kubuntu Feisty Fawn
Posts: 12

Rep: Reputation: 0
Add a timestamp to photos by reading the file date...?


I'm working with my photos, and none of them have a timestamp on the picture automatically added by the camera. (Good when using as desktop backgrounds; bad when printing!)

Is there a program that can add a timestamp to an image by reading the EXIF info, or the file creation date? Preferably native for GNU/Linux, preferably free/open-source. (I'm using Ubuntu 7.04 Feisty.)

I did a quick google search on "timestamp images", and it led me to TimeToPhoto: http://avpsoft.com/products/timetoph...imetophoto.com
Something like that would be nice. It seems to add the date to the corner of the picture.

Thanks all,
FSHero :-)
 
Old 09-11-2007, 04:51 PM   #2
jschiwal
Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654
Do you want to add the date to the exif info or actually to the image itself? If the later, look at the ImageMagick package. The ImageMagick home page may have a tutorial on adding text to images.
 
Old 09-11-2007, 05:28 PM   #3
osor
HCL Maintainer
 
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450

Rep: Reputation: 69
Quote:
Originally Posted by jschiwal View Post
The ImageMagick home page may have a tutorial on adding text to images.
It does in fact have such a tutorial. You could use the output of the exif command (the small utility that comes from the same people who make libexif) along with Imagemagick’s convert to get the desired result. For example:
Code:
#!/bin/sh
# Script to add date & timestamp to lower left hand corner of a jpeg image
# (where the date and timestamp is obtained from EXIF data if available)

# First (and only) argument is the name of the file, and the output is in
# a file whose name is derived from the original name, stripped of the .jpg
# extension, with "_anno.jpg" added

TEXT=$(exif -mt "Date and Time" $1)
[ -z "$TEXT" ] && exit 1

OUTPUT="$(basename "${1}" ".jpg")_anno.jpg"

convert $1 -fill white -undercolor '#00000080' -gravity SouthWest \
-annotate +0+5 " $TEXT" "$OUTPUT"
Of course you could tweak some things (e.g., text color, size or relative size, location, date format, etc.), but it gets the basic job done.

Last edited by osor; 09-14-2007 at 01:54 PM. Reason: typo in script
 
Old 09-12-2007, 04:53 AM   #4
FSHero
LQ Newbie
 
Registered: Jul 2007
Distribution: Kubuntu Feisty Fawn
Posts: 12

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by jschiwal View Post
Do you want to add the date to the exif info or actually to the image itself?
I want to add the date to the image itself.

Quote:
Originally Posted by osor
It does in fact have such a tutorial. You could use the output of the exif command (the small utility that comes from the same people who make libexif) along with Imagemagick’s convert to get the desired result.
Thanks; I'll have a look at it. I'll be naughty, however, and ask you a question without trying it -- Does it matter whether the pictures are portrait or landscape? Or must they all be landscape?

Thanks all, I'll look at the tutorial later and reply back.
 
Old 09-14-2007, 12:15 AM   #5
jschiwal
Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654
Quote:
Originally Posted by FSHero View Post

Thanks; I'll have a look at it. I'll be naughty, however, and ask you a question without trying it -- Does it matter whether the pictures are portrait or landscape? Or must they all be landscape?

Thanks all, I'll look at the tutorial later and reply back.

I don't know, but it may make a difference what the exif orientation info says.
 
  


Reply

Tags
pictures, timestamp


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Current timestamp by reading a file ruj.sabya Linux - General 2 04-17-2007 07:36 AM
How to get date from unix timestamp ruj.sabya Linux - General 9 03-22-2007 05:59 PM
Insert date and timestamp Into File name petenyce Linux - Newbie 9 10-13-2005 12:16 PM
Converting the date (not timestamp) mpgram Programming 2 04-18-2004 03:56 PM
add timestamp to name of file how? supafly Linux - General 3 11-14-2001 11:06 AM


All times are GMT -5. The time now is 12:48 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration