Skip to content

如何导出照片正确的拍摄时间

calendar_today 2023.04.16
schedule 2 min read

在备份几年前的旧照片到 iCloud 时,发现导入照片在 iCloud 上的时间线有误,显示为照片的导入时间,而非照片的拍摄时间。 照片在拍摄时,有一些元信息存储在 Exif 中,包括拍摄时间、拍摄时间等。在导入 iCloud 时,希望根据照片的拍摄时间进行显示,这样在看到照片时,能够回忆起拍摄时的场景。

安装 jhead

jhead 是一个可以编辑图片元信息到命令行工具。

Jhead is a command line driven program for manipulating the non-image parts of Exif flavour JPEG files that most digital cameras produce.

brew install jhead

Things jhead can extract from an Exif jpeg file

  • Time and date picture was taken
  • Camera make and model
  • Integral low-res Exif thumbnail
  • Shutter speed
  • Camera F-stop number
  • Flash used (yes/no)
  • Distance camera was focused at
  • Focal length and calculate 35 mm equivalent focal length
  • Image resolution
  • GPS info, if stored in image
  • IPTC header
  • XMP data

Things jhead can modify in an exif jpeg file

  • Up-right images according to rotation tag using jpegtran
  • Set or relative adjust internal exif timestamps
  • Fix date / time offsets in large batches of images
  • Re-name or date stamp files according to exif timestamp
  • Transfer exif headers between images
  • Replace thumbnails inside Exif headers
  • Edit jpeg comments (but not the Exif comments)
  • Delete exif or comment sections from jpeg images
  • Create new minimal exif header containing date and thumbnail

查看照片Exif 信息

jhead 招生信息.jpeg

  Downloads jhead 招生信息.jpeg
File name    : 招生信息.jpeg
File size    : 5164623 bytes
File date    : 2023:03:11 16:17:36
Resolution   : 1024 x 12091
JPEG Quality : 100
Comment      : {"data":{"activityName":"","imageEffectId":"","filterId":"","product":"retouch","pictureId":"640AB745-0641-415C-94C3-9F01C11E009A","infoStickerId":"","playld":"","stickerId":"","appversion":"7.2.0","os":"ios"},"source_type":"douyin_beauty_me"}
======= IPTC data: =======

修改照片时间

jhead -ft xxx.jpg

// 也可以对当前文件夹下的所有文件修改
jhead -ft *.jpg

Exif 信息

Exchangeable image file format: 可交换图像文件,记录数码相机照片的元信息,包括属性信息和拍摄数据。

标签号Exif 定义名中文定义名备注
0x010EImageDescription图像描述
0x013BArtist作者
0x010FMake生产商
0x0110Model型号相机型号
0x0112Orientation方向
0x011AXResolution水平方向分辨率
0x011BYResolution垂直方向分辨率
0x0128ResolutionUnit分辨率单位
0x0131Software软件固件 Firmware 版本或者编辑软件
0x0132DateTime日期和时间照片最后修改时间
0x0213YCbCrPositioningYCbCr 定位
0x8769ExifOffsetExif 子 IFD 偏移量
0x829AExposureTime曝光时间快门速度
0x829DFNumber光圈系数光圈的 F 值
0x8822ExposureProgram曝光程序自动曝光、光圈优先、快门优先、M 档等
0x8827ISOSpeedRatingsISO 感光度
0x9000ExifVersionExif 版本
0x9003DateTimeOriginal拍摄时间照片拍摄时间
0x9004DateTimeDigitized数字化时间照片被写入时间
0x9204ExposureBiasValue曝光补偿
0x9205MaxApertureValue最大光圈
0x9207MeteringMode测光模式平均测光、中央重点测光、点测光
0x9208Lightsource光源一般记录白平衡
0x9209Flash闪光灯闪光灯状态
0x920AFocalLength镜头焦距镜头物理焦距
0x927CMakerNote厂商注释
0x9286UserComment用户注释
0xA000FlashPixVersionFlashPix 版本
ColorSpace色彩空间AdobeRGB、sRGB 等
ExifImageWidth图像宽度
0xA003ExifImageLength图像高度
0xA433LensMake镜头生产商
0xA434LensModel镜头型号

关注公众号 技术后花园 获取更多信息

image.png