R将EXIF数据写入JPEG文件

时间:2017-11-14 19:41:43

标签: r exif

对于R,我发现只能阅读EXIF数据。

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

1 个答案:

答案 0 :(得分:2)

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

安装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 [where(date_exif [,4]%in%latlon_exif [i,4]),8])数据和时间格式:&#39; 2017 -11-16 22:33:17&#39;

相关问题