开发者

how to modify exif according to filename in ubuntu

I have a bunch of photos taken from old mobile phone (i.e. Motor开发者_开发百科ola 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!


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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜