Page 1 of 1
Google Photos Takeout mess
Posted: 10 Jan 2020 22:51
by daniel
I'm in the process of moving my pictures from Google Photos to something more privacy focused. Unfortunately the only viable way to get the photos from Google Photos is via their Takeout option. This means all photos are stripped of their EXIF data and the create and modified dates are all messed up. Instead you get a .json file for every picture that contains the relevant information.
I haven't found a way to merge those .json with the .jpg files but all pictures are sorted in folders like this:
takeout_folders.jpg
Is there a way to set the create/modified or even the EXIF data to the date in the co corresponding parent-folder? Unfortunately a lot of folders have a number (#2, #3, ...) attached as there are multiple folders with the same date.
If you have any other ideas to get the correct date of a picture so they display in order I would be very grateful!
Re: Google Photos Takeout mess
Posted: 10 Jan 2020 23:13
by highend
You say that all images are stripped of their exif data? Can't reproduce this.
I've uploaded a few images with gps coordinates (latitude, longitude) in their exif data
and after getting the whole archive via takeout, all exif data of the files are still intact...
Apart from that:
You want the parent folder name (e.g. from the picture you've posted: 2019-12-15 #2) changed
to the value from the exif date "photoTakenTime" from the first file that is inside such a folder?
So as an example:
Code: Select all
Folder name: "2019-12-15 #2"
Let us assume that there are 10 .jpg files in that folder
Let us assume the FIRST file is named: "Holy cow.jpg"
Let us assume the photoTakenTime from the belonging .json file "Holy cow.jpg.json" is "formatted": "15.12.2019, 15:23:57 UTC"
Then you want the folder "2019-12-15 #2" to be renamed to lets say: "2019-12-15 15-23-57"?
Re: Google Photos Takeout mess
Posted: 12 Jan 2020 22:58
by daniel
Did you test it with the original upload setting or the one where Google reduces the quality of your pictures so you get unlimited storage? I'm using the later and the stripped EXIF data seems in line with what others are reporting.
Anyway, I'm trying to grab the date in the folder-name and apply it to the files in that folder. Either as the created, modified or directly in the EXIF data.
Re: Google Photos Takeout mess
Posted: 12 Jan 2020 23:10
by highend
The .json for each file contains the correct date, so just use that...
Code: Select all
$jsons = quicksearch("*.json", , , "s");
end (!$jsons), "No .json file(s) found, aborted!";
setting "BackgroundFileOps", 0;
foreach($json, $jsons, <crlf>, "e") {
$imageFile = regexreplace($json, "\.json$");
if (exists($imageFile) == 1) {
$jsonData = readfile($json);
$photoTakenTime = regexmatches($jsonData, "[""]photoTakenTime[""]: \{[\s\S]+?\}");
$photoTakenTime = regexmatches($photoTakenTime, "[""]timestamp[""]: [""][^""]*?[""]");
$photoTakenTime = trim(gettoken($photoTakenTime, 2, ": ", "t", 2), chr(34));
$photoTakenTime = formatdate("1970-01-01 00:00:00", "yyyy-mm-dd hh:nn:ss", "s", $photoTakenTime);
if ($photoTakenTime) { timestamp "cm", $photoTakenTime, $imageFile; }
}
}
And if you want the exif date set, get e.g.
https://www.exiv2.org/index.html
and use that to set that date...