It's a blog

Add Exif data back to Facebook images – 0.1

Screenshot of the Facebook Exif tool

EDIT: Version 0.10 was released in April 2020 https://addshore.com/2020/04/add-exif-data-back-to-facebook-images-0-10/

In 2016 I wrote a blog post with this exact title when moving all of my pictures from Facebook to Google photos. I wrote a hacky little script which met my needs and added exif data from a HTML Facebook data dump back to the images that came along with it.

A few months ago I took another look at the script and made it slightly easier to run, but it still fell short on the usability side of things.

Since then more and more people have and been commenting and messaging me wanting to do exactly the same thing, and so I finally made a more usable version of my little tool.

How to use it?

The latest release of the tool can be downloaded from Github (0.1 as of writing this).

The tool is distributed as a jar file, and you’ll need Java in order to run it, which you can download here.

You’ll also need to download a JSON dump of all of your Facebook data with high resolution images and extract it locally. You can find the instructions here.

Once you have the tool running you’ll find yourself faced with a simple UI with just 2 fields to fill out and 1 button to run the tool over your facebook images.

The first field needs to point to the location of the “photos_and_videos” directory inside your extracted Facebook data dump.

The second field needs to point to a copy of exiftool by Phil Harvey. If you are running the windows bundle version of the tool or already have exif tool installed and in your PATH then this field will already be populated.

Then click Run!

The output is pretty basic and the tool can be pretty slow, but it will step through each album and each file, ending with “Done!!”.

The files will be altered in place but a copy of the original file will be left by its side with the “_original” suffix. If everything seems okay after the tool and finished you can delete the originals and just keep the adjusted files.

Which Exif data is re added?

Currently the tool will add:

  • Time taken
  • Time modified
  • The camera make
  • The camera model
  • Coordinate data (latitude & longitude)
  • Exposure
  • ISO Speed
  • Focal Length
  • F number

There could be other bits of data that I missed when writing the main logic of the script, and if there are any requests they should be fairly trivial to add.

70 Comments

  1. Joe

    Hi, I’m trying to run this on my facebook export with 30 albums but it’s just giving me this output (Windows 10 64 bit):

    Task started!
    Looking for albums…
    0 albums found!
    Done!!

    Any ideas?

    • addshore

      Are you using the JSON dump?
      It’s possible that the dump format has changed yet again (I can re download mine again and try it out).
      In your photos_and_videos directory do you have a directory called “album” with a bunch of files ending in .JSON in it?

      • Joe

        Ah, I assume my export is the wrong format then? It’s from 29/09/2018 and all the files in ‘album’ are html. I’d re-export but I deleted my account at the time lol.

        • addshore

          Aaah yes, right now this only works with JSON.
          I can have a go at adding HTML export support.
          If I do I will add another comment here!

          • Cesc Canet

            Yes please! HTML option is needed!

          • addshore

            Is this for an old or current HTML download?
            I’m not sure if the format has changed at all for it.
            If it is current, then you can always just download a JSON copy too!

  2. Jake

    addshore.. I am having a problem as well. When I run the script I get this:

    Task started!
    Looking for albums…
    82 albums found!
    === Apples! ===

    Apples! is the name of my first folder but it doesnt do anything after that. I am using .json files.

    • addshore

      Hi!
      What OS is this on?
      Which version number of the app is this?
      Which version of exiftool is being used / are you using the version with it bundled (windows only).
      I should make it print some of this at the start of the output to aid debugging…
      Thanks

    • addshore

      I just released a new version which might help you debug the issue / get some more info about what is happening.
      https://github.com/addshore/facebook-data-image-exif/releases/tag/0.2
      Try the debug output mode and also the dry run mode!

  3. A

    Hey, thanks for all of your work and for updating this but I’ve tried your v.2 on Windows 8.1 following all of the instructions for the extracted JSON but it’s stuck on the first photo on the first album – it also won’t let me change the directory for the Exiftool.exe (it links to a Temp folder). Does the Exiftool have to be placed within the photos and videos folder? Either way I can’t change the directory link in your .jar. It’s just stuck on the first photo! Thanks!

    • A

      It seems that because the .jar auto-links to the Exiftool in the Temp folder it might not be working because the Exiftool.exe has a string of numbers added to it…so I’m guessing it can’t be run because Windows can’t recognize Exiftool.exe9872356393495! If we were able to change the path of the Exiftool.exe I reckon this could work! Thanks!

      • A

        Also I tried this today using Exiftool v.11.28 if that makes a difference! Thanks!

        • addshore

          It worked with 11.28?
          So, you can always download the jar that does not have -windows in the name, then exiftool will not come with it.
          I will:
          – Make it so you can change to tool even in the bundle
          – Test the bundle some more and figure out what’s going on
          – Suggest your version of exiftool tool?
          Maybe I shouldn’t create the bundled windows version at all.
          Thanks for all the feedback

        • Jake

          Version: 0.3
          OS: Windows 10
          Debug: false

          Dry run: false

          Looking for albums…
          82 JSON album files found
          0 HTML album files found

          I got this far and it stalls. Anybody at this point?

          • Jake

            Or like this and it freezes

            Version: 0.3
            OS: Windows 10
            Debug: false

            Dry run: false

            Looking for albums…
            82 JSON album files found
            0 HTML album files found
            Album: Apples!, 18 photos
            – Processing photos_and_videos/Apples_ef11QAeXKw/307682_2079988718160_237732440_n_2079988718160.jpg

          • addshore

            Hmm, which version of exiftool are you using?

          • addshore

            I just updated the tool yet again with a 0.5 version.
            I remembered that when you download exiftool it is called exiftool(-k).exe, but that will not work, it must be called exiftool.exe.
            Perhaps this was tripping you up? I have added a check in the tool to make that situation more obvious.

  4. kalico

    Very excited to use this script!! Thanks so much. I am having a problem tho — the interface is changing my path to facebook files.

    I typed in

    /Users/XXXX/Documents/facebook-xxxxxxxxxxx-Feb2019/photos_and_videos

    and this is what the debug returns:

    Version: 0.3
    OS: Mac OS X
    Debug: true

    Dry run: true

    Looking for albums…
    debug: In album dir: /Users/XXXX/Documents/facebook-xxxxxxxxxxx/photos_and_videos\album

    Note the \album at the end….that’s a backslash, which is not a thing on a Mac.

    Can you please change this to a forward slash so the script runs on a Mac? (PS I downloaded the Mac dmg from Github)

    Thanks!

    • addshore

      Thanks for the feedback.

      I haven’t managed to try this out on a Mac yet, I’ll try and look into this in the next couple of days.

      I’m curious about the dmg, dmg of this tool or of exiftool?

      • kalico

        Ack…sorry. Yes, the dmg was not yours, it was the exif tool. What I was thinking of is your .jar file that is “not windows” so I jumped to saying .dmg when it was really a .jar. Looking forward to the fix. One additional question….does this script fix photos that you were tagged in, as well as photos you posted? Or maybe the better question is whether the FB download includes those….

        • addshore

          If you check back on the downloads page you will find a 0.4 version that should fix your path issue.

          As far as I have been able to tell the facebook dump doesn’t contain photos that you have not uploaded, so no photos that you have been tagged in in there :/
          If you find them let me know and I can make sure the script works for them.
          I also might look at scripting an easy way to grab them all in the first place.

          • kalico

            Thanks so much for working on this issue. I gave it a try, and it seems to be stuck. It identifies the albums exist, but that’s all. The output for a dry run with debug is below;

            Version: 0.4
            OS: Mac OS X
            Debug: true

            Dry run: true

            Looking for albums…
            debug: In album dir: /Users/Marci/Documents/facebook-marciabraham-Feb2019/photos_and_videos/album
            58 JSON album files found
            0 HTML album files found

            I thought maybe a dry run would only go that far, so I did a live run, and got the same results:

            Version: 0.4
            OS: Mac OS X
            Debug: false

            Dry run: false

            Looking for albums…
            58 JSON album files found
            0 HTML album files found

            Btw, at first I downloaded the 0.5 version, because it was at the top of the page. It did nothing at all (literally nothing in the output, just a blank frame). I’m not sure if that’s because it was the wrong version, but there isn’t really anything on the github page that says what is different about each version. Just wanted you to know in case 0.5 should have worked.

          • addshore

            The only thing I can think of doing right now is adding even more debug output to try and pin down exactly what is happening, I’ll do that in the next version.
            If you download and extract https://github.com/addshore/facebook-data-image-exif/archive/0.5.zip and point the tool at the ‘facebook-example’ directory in that what happens?

          • addshore

            I made some bug fixes, Please try out 0.6 or 0.7 https://github.com/addshore/facebook-data-image-exif/releases

          • kalico

            And if you have the ability to grab the “photos of you” (which I think is all the photos you are tagged in) that would be A-MA-ZING!

          • kalico

            Finally got back to this (too much work travel lately). Thanks for all the great work on this! I was able to do the full run successfully! However, all the “creation” dates on my photos are now “today”. The debug says “DATE_TIME_ORIGINAL got from creation_timestamp:” and it has a subset of the characters in the original filename. (I can’t copy/paste this out of the debug interface, sorry…if you need it, I can do it character by character…..or I could do a screenshot, lmk).

          • addshore

            So, the dates that show today are just the last modified dates. (some other people have also run into this issue).
            The tool only sets the exif data, this data is used by services such as google photos and can be seen in various image programs and tools.

            Take a look at my comment at https://addshore.com/2019/02/add-exif-data-back-to-facebook-images-0-1/#comment-344
            This tool seemed to fit perfectly for other people https://addshore.com/2019/02/add-exif-data-back-to-facebook-images-0-1/#comment-345

            I should add some extra text to the tool helping people out regarding this point.

  5. Jake

    Addshore… I’m using the 11.28 version and I changed exiftool(-k).exe to just exiftool.exe. Thanks

    • addshore

      And it worked? :)

      • Jake

        Unfortunately it didn’t work even after I changed the exiftool settings.

        • addshore

          Today I managed to try the tool on Windows 10 with exiftool 11.28 on a totally clean machine and it seemed to work just fine with my test data download / directory.
          If you download and extract https://github.com/addshore/facebook-data-image-exif/archive/0.5.zip and point the tool at the ‘facebook-example’ directory in that what happens?
          I’m going to download an updated version of my real facebook dump to see if anything has changed.

          • addshore

            I made some bug fixes, Please try out 0.6 or 0.7 https://github.com/addshore/facebook-data-image-exif/releases

          • Jake

            I tried it again and now it is having a problem finding my dump. I renamed the directory to match with yours (since that field is now editable anymore) and it says it cant find my photos_and_videos. Thanks but I seem to be moving backwards :(

          • addshore

            Which version were you trying?
            What was the input that you were putting in the first field?
            What was the exact error message it was giving you?
            The field is editable, perhaps I need to poke the UI to better reflect that (I think the placeholder text is a bit dark)..

  6. Jake

    Addshore.. I tried to change the first field and it was a no go. I tried v3-v7 and got the same result each time. The exact error it was given me was in a popup box that had a white x in a red circle and it said director does not exist \photos_and_videos. I am on a windows 10 machine.

    • addshore

      If the error is saying “\photos_and_videos” then you have no entered a directory.
      If it is not letting you enter a directory then something else is wrong, but there is some placeholder text in the field initially, putting your own path in the field however will remove that.
      I recorded a little video showing this https://i.imgur.com/pTfkP6G.gifv
      In version 0.8 (not yet released) I’ll add a different message if one of the fields is not filled, and also prefix the placeholder with “Example:” to make it more obvious that it should be changed.

      • Jake

        Addshore.. The video helped tremendously and it is working. I got tripped up by the placeholder because it didnt light up or change when I tried to erase (definitely my user error). As soon as I clicked on it and it disappeared I figured it out. Thank you so much!! You are a lifesaver. I bought you a cup of coffee and I hope you enjoy!

        • addshore

          Amazing, and thanks for helping me test it!
          The next version will have a small improvement to make the placeholder text clearer, and I’ll be writing a new blog post explaining everything now the tool has evolved somewhat.
          Be sure to tell your friends!
          (I didn’t see the coffee yet, but maybe the things is broken)

        • Jake

          Addshore.. You are still amazing, that you were able to code this, but I just looked at the new files that were made and it says they were made this morning? I am going to try it with a fresh data dump which I hope fixes the problem. I will let you know.

          • addshore

            Which date are you looking at specifically?

            The tool tries to extract a couple of different dates from the JSON provided by facebook, first the “taken_timestamp” if available, then the “modified_timestamp” and finally the “creation_timestamp”.
            When the tool finds one of these it should store the date in the DateTimeOriginal value in the exif data.
            Then the “modified_timestamp” is found it will be set to to the ModifyDate value in exif, or the current date will be used (this might be what you are seeing?).

            If you don’t find DateTimeOriginal in the exif data then it could be that facebook does not hold the date in the JSON for the album, you could open the JSON and have a look to see what dates are provided (it is possible that I have missed something)

          • Jake

            Do I have to wait for it to finish before the data is filled in? Its telling me that it was created today at 9

  7. Jake

    I thought I was a little more computer savvy then I am.. Where are these fields suppose to be? Can you please make another video of how to get to this data?

    • Jake

      This is what I found in the json file “creation_timestamp”: 1382704439

      • addshore

        I made an example video https://i.imgur.com/NGf5H2K.gifv
        Version 0.8 has even more debug output so you can see what exif data exactly is being extracted as the tool progresses through the files.

        1382704439 is equivalent to 25 October 2013, so that probably seems correct.
        In order to take full advantage of the data in the exif you will probably have to use another tool to sort all of your images.

        Take a look at some of the links in this google search and this article or perhaps this tool. (not tested by me)

        • A

          It WORKED! Thanks a lot for your efforts!

          It seems either my laptop overheated or the app crashed because my laptop had turned off in the morning and some of the newer photos didn’t have their dates changed so I’m just going to try those folders again.

          I downloaded my images/videos in JSON format, used Windows 8.1, Version 0.8 of your program, Exiftool 11.28. It didn’t seem to have worked but then I read your comment above about using Exifsort and that sorted them perfectly!

          Thanks, now I can upload to Google Photos and they will be in order! Woop!

          • addshore

            Thanks for the feedback :)

            Maybe I should add a note to the UI about using another tool to sort the files once exif data has been added back to the UI :)

            You shouldn’t actually need to use a tool to sort them once the data has been added if you are just adding them to google photos, as it is clever enough to use the exif data already!

  8. A

    It seems my laptop would go to sleep after 30 mins so that’s why I thought it had only done about half of them – but I’ve re-tried it (changing the laptop sleep setting to Never) and again it doesn’t seem to have done all of the folders/files, weird. Maybe a debug that tells you how many pics/videos before processing and how many successfully processed at the end so we can see if they’ve all been done?

    Either way it did my older photos correctly (I think) so I might just leave it at that, thanks again!

    • addshore

      The debug output should help you figure out exactly what happened during the run.
      If you want help decoding it drop me an email :)
      At the end of the run it should say how many images it has completed vs failed.

  9. Evan

    Hey, thanks so much for making this tool, it worked perfectly for me!

  10. Chad

    Not working for me. No error. Just says “Task is Starting”. Nothing seems to happen after that.

    • addshore

      Do you get any extra output with the debug mode turned on?
      Also please paste the whole output with debug mode on somewhere and send me a link :)
      Happy to help.

  11. RBrNx

    Hi addshore, thanks for making this tool!

    To anyone that is stuck on “Task is Starting”, try to rename the exiftool from “exiftool(-f).exe” to just “exiftool.exe”.

    I have a weird issue, although I’m sure there is nothing you can do about it. When I downloaded all my albums from Facebook, absolutely none of the .json files have anything more than the “upload_ip” stored against them, so unfortunately I think I’ll have to change all the pictures manually on Google Photos.

    I’ve got an example here: https://gist.github.com/RBrNx/a01a8ba2ce717e7e15a4b8a201d3e74c. All 29 albums I downloaded are the exact same, ones from 2013 all the way until 2017. Not sure if there is some Facebook setting affecting this?

    Have you seen this before?

    • addshore

      It sounds like Facebook just doesn’t have any data about your pictures.
      It’s possible the exif data was removed before uploading it to Facebook.
      Would it be useful to have the upload timestamp for the picture added to the exif data?

      • RBrNx

        Yeah it’s really weird. It’s a possibility, but for it to happen to pictures that have been taken on multiple devices over multiple years seems odd.

        It might be a useful feature to add to the application for sure, but it’s probably not much help to me as I know there’s several albums I’ve uploaded many months after actually taking them. Google Photos has a pretty good “Edit Date and Time” feature, so I’ll probably just use that!

      • ail0

        Hi, I’m having the same issue where Facebook doesn’t have any data about my pictures, but it’d be amazing if the upload timestamp could still be added to the exif data! At least I’d be able to have my photos somewhat sorted chronologically that way.

  12. Chris

    Wow this worked!!! You are a life saver. I lost all my iPhone photos and only had my photos backed up on Facebook. At first it looked like it didn’t work, because the “Date Created/Modified” wasn’t changing, but I checked the EXIF date after watching your demo video and it did change! I know nothing about coding and this was seriously so easy to do.

    THANK YOU SO MUCH! I really appreciate how easy you made it and all the revisions you made to make this foolproof.

    • Chris

      Hm so it looks like some of the photos did not have a date added to them. Is there a way to quickly edit your code so that it uses the “content_timestamp” as the EXIF date instead of the “DATE_TIME_ORIGINAL”? I am looking to use the photo upload date as the EXIF date. Thanks!

  13. Chris

    hey addshore! thanks so much for making this available. i did a dryrun and if it says: “debug: DATE_TIME_ORIGINAL could not find a source” for each photo, does that mean that it wasn’t able to find exif data?

  14. Ben Myton

    Hey Addshore, with Chris I’m having an issue where the program processes all of my images but the EXIF data remains blank. I suspect there was not EXIF data on the original image.

    Using the “Uploaded” date into Facebook would be a good work-around, is it possible to do that?

    Thanks!

    • addshore

      Defintely possible, I’m currently still travelling and without a device to develop on however.
      I’ll try and get around to this before the end of the year (unless someone else beats me).

      • Ben Myton

        Awesome, thanks for the reply!

  15. Caio

    Thanks for taking the time and effort to build this tool!

    I have downloaded everything, and the .jar file runs smoothly, and goes trough all my albums and files, but the exif data does not change.

    What could I have done wrong?

  16. Oliver Mihm

    Hi,
    THANKS for taking the time to create this!
    Got the app to run.
    For other folks: had to rename the exif tool to remove the (-k). (That option causes the tool to pause after each file it processes.)
    Also had to download the latest version of java.
    Anyhow… the tool now executes successfully!
    But I was not seeing any changes to the Date Taken field.
    Did some root causing…
    Each file had the following comment in the processing feed: “debug: DATE_TIME_ORIGNAL could not find a source”
    Dug into my json files. Each json photo entry looks like this:
    "uri": "photos_and_videos/MobileUploads_xxxx/15167668_166609157141596_6501179293305508223_o_166609157141596.jpg",
    "creation_timestamp": 1480178054,
    "media_metadata": {
    "photo_metadata": {
    "upload_ip": "217.81.36.197"
    }
    }

    I can see that the json file includes a creation_timestamp. Not sure why the script isn’t pulling it?
    I looked at the source code and the example files included with the github download…
    This prompted me to modify my json file for the first photo so it looks like this instead:
    "uri": "photos_and_videos/MobileUploads_xxxx/15167668_166609157141596_6501179293305508223_o_166609157141596.jpg",
    "creation_timestamp": 1480178054,
    "media_metadata": {
    "photo_metadata": {
    "creation_timestamp": 1480178054,
    "upload_ip": "217.81.36.197"
    }
    }

    This worked. e.g. by moving the creation timestamp into the photo metadata, the script found it, and applied it to modify the Date Taken field.
    This doesn’t help me in the short run, but maybe addshore can tell me what I’m doing wrong, or look at the source code to confirm that it can find the creation timestamp based on where FB is putting it?

    • addshore

      This sounds like the same issue that some people have reported above.
      Basically you have the situation where the image itself doesn’t have any data, but facebook does know when you uploaded it / created it on facebook (as far as I can tell).
      This wasn’t useful for me when I personally ran the script, as all of my images had some sort of data.

      The next version will have to have this as an option (pulling in this other date).
      Let me see If I can get this done soon….

      • SP van Zyl

        Hi,

        This function would be amazing as it would mean that all the photos which don’t have existing EXIF data will be able to get the ‘other’ dates from Facebook. I would live this feature!

        Any ETA on this?

  17. Christy

    This worked BEAUTIFULLY. Thanks so much for putting this together… after reading that all exif data was scrubbed from FB images I gave up on this endeavor a couple years back. My boredom and curiosity peaked during quarantine times and I ended up finding your post! Now in the process of uploading several thousands of photos (yeah….) onto Google Photos. 🙂

  18. Tonko

    Works like a charm, excellent, thank you!

  19. Kyle

    Works great, thanks!!!

  20. Chris

    Dude thanks so much for making this, it took me about half an hour to play around with in Parralells on my Mac but got it working in the end!

Leave a Comment

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

© 2020 Addshore

Theme by Anders NorénUp ↑

%d bloggers like this: