Switching between services that store a lot of your data, like email providers or file/photo syncing services, can be a hassle. Fortunately, in response to the EU's data portability rules under the GDPR (General Data Protection Regulation), many services now allow you to export all or some of the data they hold about you. This ruling has brought with it easier ways to export otherwise hard-to-access data, such as the ability to extract all your saved photos from a Facebook Messenger conversation or download all your saved files and photos from a platform like Google Drive or Google Photos.
Google offers this option for photos (among others) via takeout.google.comwhere you can select some or all of the data the company has stored on your account and export it as a series of ZIP dumps. We've covered how to export all of your photos from Google Drive before on XDA, but unfortunately Google makes this process a little more difficult than it needs to be by storing your photos' metadata separately from each photo.
We'll show you how to export all your photo data via Google Takeout while retaining the associated metadata.
How to export your data from Google Photos
Before we get into anything too complicated, let's explain how to export your data from Google Photos. Follow the steps below to download your data.
- Go to takeout.google.com and sign in with your Google Account.
- Once you've signed in, you should see a screen like the one below. The number of services available may depend on which Google services you've used in the past.
- First, deactivate all services with the Deselect Checkbox
- Scroll down to Google Photos in the Takeout list and check the box. By default, this will select all your photo albums. By clicking All photo albums includedyou have the option to limit your export to certain years or albums in your account.
- Scroll to the bottom of the page and press Next step.
- You will be asked how you would like to receive a link for your file. We recommend keeping the default settings here so that a link is sent to your account email so that you can download the files once they are prepared and save them as ZIP files. You will also be asked how large you want your ZIP files to be. We recommend keeping the default size of 2GB.
A smaller file size means more unique ZIP files to export, but can help reduce later problems when remerging your metadata, so we recommend using the default setting unless you're exporting hundreds of GB, in which case increase the size to 5 GB.
- Once you have selected your options, click Create exportOnce the export is complete, Google will email you a link that will take you back to takeout.google.com to download your files.
- Download and extract your ZIP files. We recommend that you keep them separately in a folder for now – i.e. don't combine the extracted folders yet. Also, don't delete your original ZIP files – you'll want to keep these in case something goes wrong.
When you look at your exported and extracted ZIP files, you may notice a few things. First, all of the photos are missing metadata. Second, each JPEG file has an associated JSON file, which upon closer inspection contains the metadata for that file. This is a quirk of Google's data export and can be annoying if you want to move to a new platform or service. If you were to re-upload all of these files directly, you would lose the date and time, camera, location, and other important data associated with the photos.
Luckily, we can fix this with a little Python. Follow the steps below to recombine your metadata and photos.
- To recombine your photos and metadata, we use a tool called GPTH (Google Photos Takeout Helper). It is FOSS and available both as source and as a binary on Github. We chose it because it has good support for macOS, Linux and Windows.
Source: Github
- Browse GPTH's Publications Page for the latest version. At the time of writing, this was v3.4.3. You can find the Releases section in the right sidebar of Github.
- Download the binary for your platform, in my case it is for macOS, and place it in the same directory as the extracted folder you downloaded from Google Takeout earlier.
- Open a command prompt and navigate to the directory where your folders and the downloaded binary are stored. If you are using macOS or Linux, you will need to grant execute permission using the following command.
sudo chmod +x gpth-macos
For macOS, a few additional steps are required. If you're using an Apple Silicon Mac, you'll also need to enable Rosetta emulation and tell Gatekeeper to ignore the file. Do this with the following two commands:
softwareupdate --install-rosetta
Followed by:
xattr -r -d com.apple.quarantine gpth-macos
- On Windows, simply double-click the downloaded EXE file to run it. On macOS and Linux, you can run it from the terminal with:
./gpth-macos
or
./gpth-linux
- Follow the prompts to select a take-home folder and an output destination folder. The script will loop through all the libraries in the folder and keep them separate while merging the metadata and original photos into a single file. You'll also be asked if you want to group your finished photos into one big folder or into year/month folders – this is a personal preference.
- You will also be asked how you want to handle albums. We recommend using the default option here, but if you experience problems importing or transferring your files to another device, try this process again and select Duplicate copy. While this takes up more storage space (twice as much as the original photo download), it is ultimately the method with the least chance of error.
- After running the script, navigate to your destination folder. You should see combined files with all metadata intact that you can easily import into another photo management service of your choice.
Exporting Google Photos can be tedious
Getting your photos out of Google Photos can be quite a chore, especially if you're planning on migrating directly to another service (or even a self-hosted service on your NAS). We recommend keeping the file size and script executions small, between 2GB and 5GB, to minimize the risk of crashes, disk space or storage issues that could interrupt the process. Keeping your files separate also makes it much easier to upload them to another service in small chunks later, especially if your internet speed isn't blazing fast.