1

I have a bunch of photos taken from old mobile phone (i.e. Motorola E7), that the file is named using the date and time that the photo was taken in the format YY-MM-DD_HHMM.jpg.

I wonder if there is any way for inserting the time and date of photo taken into these photos in ubuntu? Is jhead a possible solution?

Thanks!

2 Answers 2

1

jhead has worked for me in the past.

% apt-cache show jhead [...] Description: manipulate the non-image part of Exif compliant JPEG files jhead is a command line driven utility for extracting digital camera settings from the Exif format files used by many digital cameras. It handles the various confusing ways these can be expressed, and displays them as F-stop, shutter speed, etc. It is also able to reduce the size of digital camera JPEGs without loss of information, by deleting integral thumbnails that digital cameras put into the Exif header. 

Example:

% for file in ??-??-??_????.jpg; do timestamp=$(echo $file | sed -e 's/^/20/ ; s/-/:/g ; s/_\([0-2][0-9]\)\([0-5][0-9]\).*$/-\1:\2:00/') echo Before: jhead $file jhead -mkexif -ts$timestamp $file echo After: jhead $file done Before: File name : 08-09-10_1234.jpg File size : 356059 bytes File date : 2010:11:13 15:22:14 Date/Time : 2010:11:13 15:22:00 Resolution : 3000 x 2274 Color/bw : Black and white Modified: 08-09-10_1234.jpg After: File name : 08-09-10_1234.jpg File size : 356059 bytes File date : 2010:11:13 15:22:14 Date/Time : 2008:09:10 12:34:00 Resolution : 3000 x 2274 Color/bw : Black and white 
Sign up to request clarification or add additional context in comments.

1 Comment

the timestamp line is to much magic for me.. what format does jhead expect? i like to use stat -c %z or similar..
0

This isn't too hard to write yourself. I remember having about the same problem and wrote a small mono-program that did the trick for me. Just google c# and exif (or c++ or python or whatever suits your case) and you're on your way (if you want to solve it that way that is). I don't, however, know of any good existing applications that will do this for you.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.