在備份幾年前的舊照片到 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 定義名 | 中文定義名 | 備註 |
|---|---|---|---|
| 0x010E | ImageDescription | 圖像描述 | |
| 0x013B | Artist | 作者 | |
| 0x010F | Make | 生產商 | |
| 0x0110 | Model | 型號 | 相機型號 |
| 0x0112 | Orientation | 方向 | |
| 0x011A | XResolution | 水平方向解析度 | |
| 0x011B | YResolution | 垂直方向解析度 | |
| 0x0128 | ResolutionUnit | 解析度單位 | |
| 0x0131 | Software | 軟體 | 韌體 Firmware 版本或者編輯軟體 |
| 0x0132 | DateTime | 日期和時間 | 照片最後修改時間 |
| 0x0213 | YCbCrPositioning | YCbCr 定位 | |
| 0x8769 | ExifOffset | Exif 子 IFD 偏移量 | |
| 0x829A | ExposureTime | 曝光時間 | 快門速度 |
| 0x829D | FNumber | 光圈係數 | 光圈的 F 值 |
| 0x8822 | ExposureProgram | 曝光程式 | 自動曝光、光圈優先、快門優先、M 檔等 |
| 0x8827 | ISOSpeedRatings | ISO 感光度 | |
| 0x9000 | ExifVersion | Exif 版本 | |
| 0x9003 | DateTimeOriginal | 拍攝時間 | 照片拍攝時間 |
| 0x9004 | DateTimeDigitized | 數位化時間 | 照片被寫入時間 |
| 0x9204 | ExposureBiasValue | 曝光補償 | |
| 0x9205 | MaxApertureValue | 最大光圈 | |
| 0x9207 | MeteringMode | 測光模式 | 平均測光、中央重點測光、點測光 |
| 0x9208 | Lightsource | 光源 | 一般記錄白平衡 |
| 0x9209 | Flash | 閃光燈 | 閃光燈狀態 |
| 0x920A | FocalLength | 鏡頭焦距 | 鏡頭物理焦距 |
| 0x927C | MakerNote | 廠商註釋 | |
| 0x9286 | UserComment | 使用者註釋 | |
| 0xA000 | FlashPixVersion | FlashPix 版本 | |
| ColorSpace | 色彩空間 | AdobeRGB、sRGB 等 | |
| ExifImageWidth | 圖像寬度 | ||
| 0xA003 | ExifImageLength | 圖像高度 | |
| 0xA433 | LensMake | 鏡頭生產商 | |
| 0xA434 | LensModel | 鏡頭型號 |
關注公眾號 技術後花園 獲取更多資訊
