3

Recently used Google Takeout to download 60GB+ of photos and video from Google+.

This has resulted in plenty of files -- but valuable metadata including the original dates for photos and often location is stored in a separate metadata.json file for every album, instead of in EXIF.

This means I can't import it to any other photo service without essentially scrambling all the dates based on what G+ made automatic edits to the photos.

Can't find an answer anywhere -- solving this should help anyone out who is hoping to move their photos from Google's service elsewhere.

MyNameIsMax
  • 31
  • 1
  • 2

2 Answers2

1

There is a Exif tool out there from http://www.sno.phy.queensu.ca/~phil/exiftool/

Plenty of docs there, but some examples:

called like this exiftool -json=picture.json picture.jpg

or exiftool -filename -imagesize -exif:fnumber -xmp:all image.jpg

Stuart Siegler
  • 1,686
  • 4
  • 30
  • 38
0

I wrote this bash script after exporting Google Photos to Synology NAS. You can try this

    #!/bin/bash
    tmpFileName="filelist.txt"
    startPath="/google_drive_sync"
    exifToolPath="./Image-ExifTool-12.29/"
    showCorrectFiles="False"
    debugOutput="False"
    
   if [[ -f $tmpFileName ]]; then
    echo "FileList is exist"
else    
    echo "Creatig FileList"
    find $startPath -name "*.jpg"  >> $tmpFileName
    find $startPath -name "*.png"  >> $tmpFileName
    find $startPath -name "*.PNG"  >> $tmpFileName
    find $startPath -name "*.JPG"  >> $tmpFileName
fi

filesCount=`wc filelist.txt -l | awk '{print $1}'`
currentFile=0
needRefresh="True"
tmpCount=0
processedByJson=0
processedByFilename=0
skippedFiles=0
echo "Parsing FileList"
echo "Total files (including eaDir): $filesCount"
while read fullPathToPhoto
do
    currentFile=$((currentFile + 1))
    tmpCount=$((tmpCount + 1))
    
    if [[ "$tmpCount" -gt "100" ]]; then
    tmpCount=0
    needRefresh="True"
    fi

    if [[ "$needRefresh" == "True" ]]; then
    clear
    needRefresh="False"
    echo "Processing: $currentFile of $filesCount"
    echo "Processed by JSON: $processedByJson"
    echo "Processed by FileName: $processedByFilename"
    echo "Skipped: $skippedFiles"
    fi
    photoFileName="$fullPathToPhoto"
    if [[ "$photoFileName" == *"eaDir"* ]]; then
    isEaDir="True"
    skippedFiles=$((skippedFiles + 1))
    else
    jsonFileName="$photoFileName.json"
        modifyDate=`stat "$photoFileName" | grep "Modify:" | cut -c9-18`
    checkJson="False"
        if [[ -f $jsonFileName ]]; then
            jsonDateTime=`cat "$jsonFileName" | grep -A1 "photoTakenTime" | grep "timestamp" | awk '{print $2}' | cut -c2-11`
        jsonDateTimeFormatted=`date -d @$jsonDateTime +"%Y-%m-%d %H:%M:%S"`
        jsonDate=`date -d @$jsonDateTime +"%Y-%m-%d"`
        checkJson="True"
    fi
    isAndroidWhatsAppImage="False"
    if [[ -n $modifyDate ]]; then
        isAndroidWhatsAppImageTmp=`echo $photoFileName | grep "WA" | grep "IMG"`
        if [[ -n $isAndroidWhatsAppImageTmp ]]; then
            isAndroidWhatsAppImage="True"
            modifyDateFromFileNameTmp=`echo $photoFileName | sed 's|.*IMG||' | sed 's/WA.*//' | sed 's/[^0-9]//g'`
            yearTmp=`echo $modifyDateFromFileNameTmp | cut -c1-4`
            monthTmp=`echo $modifyDateFromFileNameTmp | cut -c5-6`
            dayTmp=`echo $modifyDateFromFileNameTmp | cut -c7-8`
            modifyDateFromFileName=`echo $yearTmp-$monthTmp-$dayTmp`
        else
            isAndroidWhatsAppImage="False"
        fi
    fi
    if [[ "$isAndroidWhatsAppImage" == "True" ]]; then
        if [[ "$modifyDateFromFileName" != "$jsonDate" ]]; then
        checkJson="False"
        fi
    fi    
    if [[ "$checkJson" == "True" ]]; then
        if [[ "$modifyDate" != "$jsonDate" ]]; then
        echo "Change dt for $photoFileName" 
        echo "from $modifyDate to $jsonDateTimeFormatted by JSON"
        perl "$exifToolPath/exiftool" "-AllDates=$jsonDateTimeFormatted" "$photoFileName" -overwrite_original
        perl "$exifToolPath/exiftool" "-FileCreateDate<DateTimeOriginal" "-FileModifyDate<DateTimeOriginal" "$photoFileName"
        processedByJson=$((processedByJson + 1))
        tmpCount=$((tmpCount + 45))
        else
        if [[ "$showCorrectFiles" == "True" ]]; then
            echo "Date is correct for $photoFileName by JSON"
            tmpCount=$((tmpCount + 45))
        fi
        skippedFiles=$((skippedFiles + 1))
        fi
    else
        if [[ -n $modifyDate ]]; then
        if [[ "$isAndroidWhatsAppImage" == "True" ]]; then
            if [[ "$debugOutput" == "True" ]]; then
            echo "Find WhatsApp image in $photoFileName"
            fi
            if [[ "$modifyDateFromFileName" == "$modifyDate" ]]; then
            if [[ "$showCorrectFiles" == "True" ]]; then
                echo "Date is correct for $photoFileName"
                echo "date is $modifyDate FileName date is $modifyDateFromFileName"
                tmpCount=$((tmpCount + 45))
            fi
            skippedFiles=$((skippedFiles + 1))
            else
            echo "Change dt for $photoFileName" 
            echo "from $modifyDate to $modifyDateFromFileName by FileName"
            perl "$exifToolPath/exiftool" "-AllDates=$modifyDateFromFileName 06:00:00" "$photoFileName" -overwrite_original
            perl "$exifToolPath/exiftool" "-FileCreateDate<DateTimeOriginal" "-FileModifyDate<DateTimeOriginal" "$photoFileName"
            processedByFilename=$((processedByFilename + 1))
            tmpCount=$((tmpCount + 45))
            fi
        else
            if [[ "$debugOutput" == "True" ]]; then
            echo "$isAndroidWhatsAppImage"
            echo "Skip image check in $photoFileName"
            tmpCount=$((tmpCount + 45))
            fi
            skippedFiles=$((skippedFiles + 1))
        fi
        fi
    fi
    fi  
    done < $tmpFileName
Д Р
  • 1
  • 2