如何根据ubuntu中的文件名修改exif

时间:2010-11-13 03:16:03

标签: ubuntu exif

我从旧手机(即摩托罗拉E7)拍摄了一堆照片,该照片是以YY-MM-DD_HHMM.jpg格式拍摄照片的日期和时间命名的。

我想知道是否有办法在ubuntu中将照片的时间和日期插入到这些照片中? jhead是一个可能的解决方案吗?

谢谢!

2 个答案:

答案 0 :(得分:1)

过去,{p> jhead对我有用。

% 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.

示例

% 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

答案 1 :(得分:0)

这对你自己来说并不难。我记得遇到过同样的问题,写了一个小单声道程序,为我做了诀窍。只需谷歌c#和exif(或c ++或python或任何适合你的情况),你就在路上(如果你想以那种方式解决它)。但是,我不知道任何可以为您执行此操作的现有应用程序。