This guide provides a step-by-step process for consolidating photos from multiple Google Photos accounts using a Google Takeout and a Python script to preserve the original photo metadata.
- Initiate a Google Takeout from the account you wish to download or move photos from. Select the necessary items and request a takeout.
- You will receive an email with a link to download your Google Photos archive.
- After downloading and extracting the archive, your photos will be organized by year within the
Takeout/Google Photos
directory.
When you download photos via Google Takeout, the created date
is modified, and the original metadata is stored in a separate .json
file for each image. This can disrupt the chronological order of your photos when re-uploading them to Google Photos.
A Python script, converted from a PowerShell solution provided by TheOriginalBvF on Reddit, can be used to address this issue. The script performs the following functions:
- Traverses directories for unique file extensions, excluding
.json
. - Collects file extensions and sorts them in descending order.
- Reads the
timestamp
from.json
files associated with each non-JSON file. - Converts the
timestamp
to adatetime
object. - Updates the last modified time of the original file to match the
timestamp
. - Moves non-JSON files to the script's current working directory, avoiding duplicates.
- Handles JSON decoding errors and unexpected JSON structures.
- Prints error messages for any issues encountered during processing.
- Backup: Ensure you take a backup of the entire
Takeout
folder before running the script. - Responsibility: The script is not battle tested and hence the author is not responsible for any data loss that may occur.
- Copy the Python script into the
Google Photos
folder within yourTakeout
directory. - Run the script using Python 3 by executing the following command in your terminal:
python3 photos.py
- Delete all your JSON files
rm *.json
- Upload all your photos to your google account.
By following these instructions, you can maintain the original metadata of your photos and keep your Google Photos timeline intact when consolidating your accounts.