R write EXIF data to JPEG file

馋奶兔 提交于 2020-02-24 12:09:49

问题


For R I found an opportunity to only read the EXIF data.

Is there any possibility in R to write EXIF data to JPEG file?


回答1:


Thanks to all who responded. As a result, I obtained the following solution.

Install ExifTool, I use Ubuntu comand:

sudo apt install libimage-exiftool-perl

Then in my R code, to add GPS coordinates to image I use:

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)

Where latlon_exif[i,11] and latlon_exif[i,10] - coordinates, latlon_exif[i,4] - name of file.

To add data and time to image I use:

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)

Where shQuote(date_exif[which(date_exif[,4]%in%latlon_exif[i,4]),8]) data and time in format: '2017-11-16 22:33:17'



来源:https://stackoverflow.com/questions/47293978/r-write-exif-data-to-jpeg-file

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!