A Python script to restore metadata (EXIF, GPS, Date Taken) for Google Photos images and videos downloaded via Google Takeout. This script supports JPG, PNG, HEIC, MOV, and MP4 file formats, restoring important metadata such as Date Taken, Creation Time, and GPS information from the corresponding .json
files generated by Google Takeout.
⚠️ Important: Please ensure you have backed up your original files before running this script, as it performs delete operations on the_original
files and.json
files after processing.
- Restores EXIF Date/Time, GPS coordinates, and other metadata from Google Takeout JSON files.
- Supports JPG (.jpg, .jpeg), PNG (.png), HEIC (.heic), MOV (.mov), and MP4 (.mp4) file formats.
- Recursively processes all files within the specified parent directory and subdirectories.
- Deletes
.json
files and_original
backup files created byexiftool
after successful metadata restoration.
- Python 3.x installed.
- exiftool: Required for metadata editing. You can download it from ExifTool Website.
-
Clone the repository:
git clone https://github.com/Hitesh297/google-photos-metadata-restorer.git cd google-photos-metadata-restorer
-
Install exiftool:
Download and install
exiftool
from the official website. For Windows, ensureexiftool
is added to your system's PATH for global usage.
-
Place the Python script (
add_metadata.py
) inside the parent folder that contains your Google Photos backups (images/videos) along with their corresponding.json
files. -
Run the script:
python add_metadata.py
-
The script will:
- Traverse the parent directory and its subdirectories for supported file formats (
.jpg
,.png
,.heic
,.mov
,.mp4
). - Match each file with its corresponding JSON metadata file (e.g.,
image.jpg
->image.jpg.json
). - Apply the metadata from the JSON file to the image or video using
exiftool
. - Delete the
_original
backup file and the.json
file after successful processing.
- Traverse the parent directory and its subdirectories for supported file formats (
If your folder looks like this:
/parent_folder/
/subfolder1/
photo1.jpg
photo1.jpg.json
video1.mp4
video1.mp4.json
/subfolder2/
photo2.heic
photo2.heic.json
Running the script will process photo1.jpg
, video1.mp4
, and photo2.heic
, apply metadata from their respective JSON files, and then delete the _original
files and .json
files after processing.
The script restores the following metadata:
- Date Taken (
DateTimeOriginal
,CreateDate
,ModifyDate
) - GPS Data (Latitude, Longitude, Altitude)
- File Creation and Modification Time
If you encounter issues while running the script, make sure:
- ExifTool is correctly installed and accessible via the command line.
- You are running the script in the correct directory (the parent folder of your Google Takeout files).
- The
.json
files are named correctly (e.g.,image.jpg
should haveimage.jpg.json
).
- Restore Google Photos metadata
- Recover EXIF data from Google Takeout
- Bulk update EXIF metadata
- Add metadata to JPG, PNG, HEIC, MOV, MP4
- Google Photos JSON to EXIF script
- GPS metadata restoration
- Python script for Google Photos backup
- Restore original photo date Google Photos
- Google Takeout metadata repair
This project is licensed under the MIT License - see the LICENSE file for details.