R 将 EXIF 数据写入 JPEG 文件

R write EXIF data to JPEG file

对于 R 我找到了一个只读取 EXIF 数据的机会。

R 中是否可以将 EXIF 数据写入 JPEG 文件?

感谢所有回复的人。结果,我得到了如下解决方案。

安装ExifTool, 我使用 Ubuntu 命令:

sudo apt install libimage-exiftool-perl

然后在我的 R 代码中,将 GPS 坐标添加到我使用的图像中:

exiftool_cmd <- paste("exiftool -GPSLongitudeRef=E -GPSLongitude=",latlon_exif[i,11]," -GPSLatitudeRef=N -GPSLatitude=",latlon_exif[i,10]," ","./nodejpg/",latlon_exif[i,4],".jpg",sep='')
system(exiftool_cmd)

其中 latlon_exif[i,11]latlon_exif[i,10] - 坐标, latlon_exif[i,4] - 文件名。

为图像添加数据和时间我使用:

exiftool_cmd <- paste("exiftool -alldates=",shQuote(date_exif[which(date_exif[,4]%in%latlon_exif[i,4]),8])," ","./nodejpg/",latlon_exif[i,4],".jpg",sep='')
system(exiftool_cmd)

其中 shQuote(date_exif[which(date_exif[4]%in%latlon_exif[i,4]),8])数据和时间格式:'2017-11-1622:33:17'