对于 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- 16 22:33:17'
关于R将EXIF数据写入JPEG文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47293978/