It's a blog

Add Exif data back to Facebook images

2019 Update: This script now exists with an easy to use GUI

2018 Update: I touched this script again in March 2019 moving it to Github and updating it with 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.


  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:
        30 August 2017 16:31
        Camera make
        Camera model
        Original width
        Original height
        ISO speed
        Focal length
        Upload IP address

        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).
      You can follow it on Github @

Leave a Comment

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

© 2019 Addshore

Theme by Anders NorénUp ↑

%d bloggers like this: