由于文件系统的特殊性,iPhone照片导入到电脑中一直是头疼的问题,我之前就遇到了这种问题,我批量的按照顺序拍摄了500+张的票据,但最终我发现AirDrop难以如此大批量的将照片传入我的Mac电脑,同时就算我尝试多种方法将照片导入成功电脑时,我发现它本身的创建日期并非照片的拍摄时间,这对我整理照片造成了非常大的困扰(因为我希望通过对创建时间进行排序,从而确定票据的顺序及分组,并最终进行整理)。
问题来源
但这实际上对于想正常保存好照片信息到电脑的人也造成了极大的困扰,当你导出照片至电脑,某一天想整理回顾时,发现创建时间完全是乱套的,给人以极大困扰,并且我发现在Windows电脑上同步照片时,也存在该种问题:
Mac与iPhone间的传输则更为麻烦,我尝试了:
(1)使用iMazing传输;结果失败,导出无反应
(2)AirDrop传输:卡在发送,取消操作后狂点AirDrop图标无反应,设置中也无法修改AirDrop的状态
(3)iCloud图库;备份较慢,需要一定的云存储空间支撑,非常糟糕
(4)使用数据线,对图库进行同步,将手机端中的照片全部同步到了Mac中;成功✅
但紧接而来的,就是如何将照片从Mac的图库中导入到电脑中存储:
(1)直接复制粘贴操作只会生成缩略图:
(2)拖拽 or 照片App-->多选后 文件-->导出-->导出x张照片:
这可能是因为弱智iPhone照片导出的创建机制问题
他真正的创建日期和拍摄信息被储存在了EXIF中:
EXIF(Exchangeable Image File format)是可交换图像文件的缩写,是专门为数码相机的照片设定的,可以记录数码照片的属性信息和拍摄数据。 EXIF可以附加于JPEG、TIFF、RIFF、RAW等文件之中,为其增加有关数码相机拍摄信息的内容和索引图或图像处理软件的版本信息
所以要做的就是从EXIF信息中提取创建日期,然后对文件的日期信息进行修改
解决方案
这种情况下,我们选择使用Jhead工具,Jhead是没有图形界面的命令行软件,需要使用终端(Mac)or 命令提示符(Windows)运行它并键入指定参数。
Exif Jpeg header manipulation tool
可以看到Jhead不仅能够提取EXIF信息,还能对其进行修改写入,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
其中加星号的对时间戳进行校正并批量处理就是我们所需要的,参考来源:
使用(傻瓜版)--最少命令行敲入
下载对应的系统版本,像我选择下载OS-X Intel可执行版本的 jhead,将其放到你需要批量修改的照片所在的文件夹中
利用cd命令载入到照片所在文件夹(可用Tab键补全 or 显示子目录)
敲入ls命令,可以显示当前目录下文件,确认是否载入正确的文件夹
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.
这是对单一文件进行修改,对于当前目录下所有文件的修改,就是用 * 符号
jhead -ft *
长久使用——Homebrew安装jhead
Homebrew是unix优秀的包管理工具,支持Mac/Linux,使用Homebrew能够快速安装jhead包,并且添加到环境变量中,无需将jhead放入要操作的目录
(1)安装Homebrew:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
##复制到终端运行
##由于某些原因中国大陆无法连接Github仓,可考虑垃圾撒比ggtree托管的国内安装源
##参见https://zhuanlan.zhihu.com/p/111014448
更多参见官网https://brew.sh/
(2)安装jhead到环境变量
brew install jhead
其他
-n参数的以拍摄日期形式命名照片感觉也是个非常实用的功能
-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格式
后来才发现可以指定命名文件的日期格式,最好的还是举例子的 %Y%m%d-%H%M%S 参数啦,精确到秒,年月日俱全
如何命名所有呢?自然就是
jhead -n%Y%m%d-%H%M%S *
###注意,n和后面的日期格式函数间没有空格,-n[<fmt-string>],formate可是他的一部分哦
Windows下的使用
手头没有Windows电脑,cmd命令与unxi有所不同,文件目录格式也不太一样,可以考虑直接复制文件路径进CMD
ls --> dir;
cd --> cd;
使用日期命名功能,需要注意%在windows中表示宏,要改用 jhead -n%%Y%%m%%d-%%H%%M%%S
即% -->%%
发送自
我的垃圾iPhone以及Mac