Addshore

It's a blog

Add Exif data back to Facebook images

Update: I touched this script again in March 2018 moving it to Github, updating it and adding Docker support.

I start this post not by talking about Facebook, but about Google Photos. Google now offers unlimited ‘high resolution’ images within its service where high resolution is defined as 16MP for an image and 1080p for video. Of course there is some compression here that some may argue against but photos and video can also be uploaded at original quality (exactly as captured) and the cost of space for these files is very reasonable. So, It looks like I have found a new home for my piles of photos and videos that I want to be able to look back at in 20 years!

Prior to Google Photos developments I stored a reasonable number of images on Facebook, and now I want to also add them all to Google Photos, but that is not as easy as I first thought. All of your Facebook data can easily be downloaded which includes all of your images and videos, but not exactly as they were when you uploaded them, as they have all of the exif data such as location and time stripped. This data is actually available in a html file which is served with each Facebook album. So, I wrote a terribly hacky script in PHP for Windows to extract that data and re add it to the files so that they can be bulk uploaded to Google Photos and take advantage of the timeline and location features.

The code can be found below (it looks horrible but works…)

I would rewrite it but I have no need to (as it works). But when searching online for some code to do just this I came up short and thus thought I would post the rough idea and process for others to find, and perhaps improve on.

5 Comments

  1. Thank you! worked well, failed on a few pictures without meta data but easily fixed, also tweaked to add the Facebook posted date to pictures where the actual exif ‘Taken’ date was absent. Thanks again :)

    • addshore

      April 25, 2017 at 7:00 pm

      Any chance you could share you tweak? :)

      • I’ve been unable to find this. Can’t see where the “date posted” is coming from, although, my Sony XPeria photos on facebook add these Exif lines:
        “Modified
        30 August 2017 16:31
        Camera make
        Sony
        Camera model
        D6603
        Orientation
        1
        Original width
        0
        Original height
        0
        Exposure
        2/1000
        F-Stop
        2/1
        ISO speed
        50
        Focal length
        460/100
        Latitude
        52.985294342041
        Longitude
        -1.8920352458954
        Upload IP address
        9x.x.x.x5”

        So quickly looking at the code, I think this bit is what could be used: (Not sure where the posted date comes from though… as can’t see it listed on any photo html files.

        • addshore

          June 7, 2018 at 7:04 am

          One thing to note is that it looks like the Facebook download my data html format has changed slightly since this was written.

    • addshore

      March 20, 2018 at 7:52 pm

      I just moved the code to Github, updated it a bit and made it easier to use (and wrote a new post).
      https://addshore.com/2018/03/cambridge-analytics-deletefacebook-adding-exif-data-back/
      You can follow it on Github @ https://github.com/addshore/facebook-data-image-exif

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

© 2018 Addshore

Theme by Anders NorenUp ↑

%d bloggers like this: