? ? 由于文件系統(tǒng)的特殊性诀拭,iPhone照片導(dǎo)入到電腦中一直是頭疼的問題摸吠,我之前就遇到了這種問題纬凤,我批量的按照順序拍攝了500+張的票據(jù)姿搜,但最終我發(fā)現(xiàn)AirDrop難以如此大批量的將照片傳入我的Mac電腦,同時就算我嘗試多種方法將照片導(dǎo)入成功電腦時我注,我發(fā)現(xiàn)它本身的創(chuàng)建日期并非照片的拍攝時間按咒,這對我整理照片造成了非常大的困擾(因為我希望通過對創(chuàng)建時間進(jìn)行排序,從而確定票據(jù)的順序及分組但骨,并最終進(jìn)行整理)励七。
問題來源
? ? 但這實際上對于想正常保存好照片信息到電腦的人也造成了極大的困擾,當(dāng)你導(dǎo)出照片至電腦嗽冒,某一天想整理回顧時呀伙,發(fā)現(xiàn)創(chuàng)建時間完全是亂套的,給人以極大困擾添坊,并且我發(fā)現(xiàn)在Windows電腦上同步照片時剿另,也存在該種問題:
? ? Mac與iPhone間的傳輸則更為麻煩雨女,我嘗試了:
(1)使用iMazing傳輸谚攒;結(jié)果失敗,導(dǎo)出無反應(yīng)
(2)AirDrop傳輸:卡在發(fā)送氛堕,取消操作后狂點AirDrop圖標(biāo)無反應(yīng)馏臭,設(shè)置中也無法修改AirDrop的狀態(tài)
(3)iCloud圖庫;備份較慢讼稚,需要一定的云存儲空間支撐括儒,非常糟糕
(4)使用數(shù)據(jù)線,對圖庫進(jìn)行同步锐想,將手機(jī)端中的照片全部同步到了Mac中帮寻;成功?
? ? 但緊接而來的,就是如何將照片從Mac的圖庫中導(dǎo)入到電腦中存儲:
(1)直接復(fù)制粘貼操作只會生成縮略圖:
(2)拖拽 or 照片App-->多選后 文件-->導(dǎo)出-->導(dǎo)出x張照片:
? ? 這可能是因為弱智iPhone照片導(dǎo)出的創(chuàng)建機(jī)制問題
? ? 他真正的創(chuàng)建日期和拍攝信息被儲存在了EXIF中:
EXIF(Exchangeable Image File format)是可交換圖像文件的縮寫固逗,是專門為數(shù)碼相機(jī)的照片設(shè)定的,可以記錄數(shù)碼照片的屬性信息和拍攝數(shù)據(jù)藕帜。?EXIF可以附加于JPEG烫罩、TIFF、RIFF洽故、RAW等文件之中贝攒,為其增加有關(guān)數(shù)碼相機(jī)拍攝信息的內(nèi)容和索引圖或圖像處理軟件的版本信息
? ? 所以要做的就是從EXIF信息中提取創(chuàng)建日期,然后對文件的日期信息進(jìn)行修改
解決方案
? ? 這種情況下时甚,我們選擇使用Jhead工具饿这,Jhead是沒有圖形界面的命令行軟件,需要使用終端(Mac)or 命令提示符(Windows)運(yùn)行它并鍵入指定參數(shù)撞秋。
? ??Exif Jpeg header manipulation tool
? ? 可以看到Jhead不僅能夠提取EXIF信息,還能對其進(jìn)行修改寫入嚣鄙,modify主要功能有以下幾點:
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
其中加星號的對時間戳進(jìn)行校正并批量處理就是我們所需要的吻贿,參考來源:
使用(傻瓜版)--最少命令行敲入
? ? 下載對應(yīng)的系統(tǒng)版本,像我選擇下載OS-X Intel可執(zhí)行版本的 jhead哑子,將其放到你需要批量修改的照片所在的文件夾中
? ? 利用cd命令載入到照片所在文件夾(可用Tab鍵補(bǔ)全 or 顯示子目錄)
? ? 敲入ls命令,可以顯示當(dāng)前目錄下文件,確認(rèn)是否載入正確的文件夾
jhead -ft “你的文件名”即可卧蜓,例如我就是
?jhead -ft 10.jpg
###官方說明
ft????Sets the Exif timestamp to the file's timestamp. Requires an Exif header to pre-exist. Use -mkexif option to create one if needed.
這是對單一文件進(jìn)行修改帐要,對于當(dāng)前目錄下所有文件的修改,就是用 * 符號
jhead -ft *
長久使用——Homebrew安裝jhead? ?
Homebrew是unix優(yōu)秀的包管理工具弥奸,支持Mac/Linux榨惠,使用Homebrew能夠快速安裝jhead包,并且添加到環(huán)境變量中,無需將jhead放入要操作的目錄
(1)安裝Homebrew:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
##復(fù)制到終端運(yùn)行
##由于某些原因中國大陸無法連接Github倉赠橙,可考慮垃圾撒比ggtree托管的國內(nèi)安裝源
##參見https://zhuanlan.zhihu.com/p/111014448
更多參見官網(wǎng)https://brew.sh/
(2)安裝jhead到環(huán)境變量
brew install jhead
其他
-n參數(shù)的以拍攝日期形式命名照片感覺也是個非常實用的功能
-n[<fmt-string>]
? ? This option causes files to be renamed and/or moved according to the Exif header "DateTimeOriginal" field. If the file is not an Exif file, or the DateTimeOriginal does not contain a valid value, the file date is used.
If the name includes '/' or '\' (under windows), this is interpreted as a new path for the file. If the new path does not exist, the path will be created.
If the [fmt-string] is omitted, the file will be renamed to MMDD-HHMMSS.
If a [fmt-string] is provided, the fmt-string will be passed to the strftime function for formatting. In addition, if the format string contains '%f', this will substitute the original name of the file (minus extension).
A sequence number may also be included by including '%i' in the format string. Leading zeros can be specified. '%03i' for example will pad the numbers to '001', '002'... this works just like printf in C, but with '%i' instead of '%d'.
If the target name already exists, the name will be appended with "a", "b", "c", etc, unless the name ends with a letter, in which case it will be appended with "0", "1", "2", etc.
This feature is especially useful if more than one digital camera was used to take pictures of an event. By renaming them to a scheme according to date, they will automatically appear in order of taking when viewed with some sort of viewer like Xnview or AcdSee, and sorted by name. Or you could use the -ft option and view the images sorted by date. Typically, one of the camera's date will be set not quite right, in which case you may have to use the -ta or -da options on those files first.
Some of the more useful arguments for strftime are:
%d ?Day of month as decimal number (01 – 31)
%HHour in 24-hour format (00 – 23)
%jDay of year as decimal number (001 – 366)
%mMonth as decimal number (01 – 12)
%MMinute as decimal number (00 – 59)
%SSecond as decimal number (00 – 59)
%UWeek of year as decimal number, with Sunday as first day of week (00 – 53)
%wWeekday as decimal number (0 – 6; Sunday is 0)
%yYear without century, as decimal number (00 – 99)
%YYear with century, as decimal number
Example:
jhead -n%Y%m%d-%H%M%S *.jpg
This will rename files matched by *.jpg according to YYYYMMDD-HHMMSS
Note to Windows batch file users: '%' is used to deliminate macros in Windows batch files. You must use %% to get one % passed to the program. So from a batch file, you would have to write "jhead -n%%Y%%m%%d-%%H%%M%%S *.jpg"
For a full listing of strftime arguments, look up the strftime function. Note that some arguments to the strftime function (not listed here) produce strings with characters such as '/' and ':' that may not be valid as part of a filename on various systems.
隨手測試了一下耽装,被修改為了MMDD-TIME格式
? ? 后來才發(fā)現(xiàn)可以指定命名文件的日期格式,最好的還是舉例子的 %Y%m%d-%H%M%S 參數(shù)啦期揪,精確到秒掉奄,年月日俱全
如何命名所有呢凤薛?自然就是
jhead -n%Y%m%d-%H%M%S *
###注意姓建,n和后面的日期格式函數(shù)間沒有空格,-n[<fmt-string>]缤苫,formate可是他的一部分哦
Windows下的使用
? ? 手頭沒有Windows電腦速兔,cmd命令與unxi有所不同,文件目錄格式也不太一樣榨馁,可以考慮直接復(fù)制文件路徑進(jìn)CMD
ls --> dir;
cd --> cd;
使用日期命名功能憨栽,需要注意%在windows中表示宏,要改用 jhead -n%%Y%%m%%d-%%H%%M%%S
即% -->%%
發(fā)送自
我的垃圾iPhone以及Mac