Addshore

It's a blog

Add Exif data back to Facebook images – 0.1

Screenshot of the Facebook Exif tool

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.

60 Comments

  1. 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?

    • 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?

      • 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.

        • 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!

          • Yes please! HTML option is needed!

          • 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. 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.

  3. 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!

    • 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!

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

        • 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

        • 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?

          • 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

          • Hmm, which version of exiftool are you using?

          • 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. 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!

    • 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?

      • 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….

        • 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.

          • 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.

          • 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?

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

          • 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!

          • 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).

          • 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. Addshore… I’m using the 11.28 version and I changed exiftool(-k).exe to just exiftool.exe. Thanks

  6. 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.

    • 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.

      • 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!

        • 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)

        • 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.

          • 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)

          • 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. 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?

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

      • 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)

        • 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!

          • 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. 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!

    • 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. Hey, thanks so much for making this tool, it worked perfectly for me!

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

    • 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. 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?

    • 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?

      • 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!

  12. 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.

    • 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. 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. 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!

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: