Mass import JSON-metadata to jpg's

Started by jesperswi, October 19, 2023, 07:06:48 AM

Previous topic - Next topic

jesperswi

I have a folder with many jpgs with corresponding metadata in json-format.
How can I add gpslongitude and gpslatitude from the json-files to every image? The TAGS in JSON are cameralongitudeDeg and cameralatitudeDeg.

The jpgs have are called xxxx.0.eo.jpg while the jsons are called xxxx.json. The "xxxx" is the samme for corresponding pairs.

StarGeek

Quote from: jesperswi on October 19, 2023, 07:06:48 AMThe TAGS in JSON are cameralongitudeDeg and cameralatitudeDeg.

I'm assuming these are the names that exiftool outputs when you run it on the json file with the -s (-short) option?  If not, run exiftool on one to get the exact name that exiftool will be reading
exiftool -s file.json

QuoteThe jpgs have are called xxxx.0.eo.jpg while the jsons are called xxxx.json. The "xxxx" is the samme for corresponding pairs.

Try this command.  Make sure and test it out before running it in batch
exiftool -ext jpg -TagsFromFile %4f.json "-GPSPosition<$cameralatitudeDeg, $cameralongitudeDeg" /path/to/files/

The -ext (-extension) option is used to make sure exiftool doesn't waste time reading any file other than the jpgs.

The %4f.json means that exiftool will only take the first four characters of the jpg filename when looking for a matching json file.  See the -w (-TextOut) option for more details on the percent variables.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

jesperswi

Thank you, it worked!

Only had to change the %4f.json to include more characters.


jesperswi

How can I add altitude as well? Tag from jpeg is "altitudem"

StarGeek

"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype