ubuntu下如何根据文件名修改exif

发布于 2024-10-02 09:13:27 字数 166 浏览 8 评论 0原文

我有一堆从旧手机(即摩托罗拉 E7)拍摄的照片,该文件使用照片拍摄的日期和时间命名,格式为 YY-MM-DD_HHMM.jpg

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

谢谢!

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!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

趁微风不噪 2024-10-09 09:13:27

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

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
胡大本事 2024-10-09 09:13:27

自己写这个并不难。我记得也遇到过同样的问题,并编写了一个小型单一程序来解决我的问题。只需谷歌 c# 和 exif (或 c++ 或 python 或任何适合您情况的内容),您就可以了(如果您想这样解决问题)。但是,我不知道有任何好的现有应用程序可以为您完成此操作。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文