Saturday, May 23, 2015

Extracting Base64 Images from Google Keep Archives

I love Google Keep! It's a nice-looking note-taking app with more features than I ever use.

But once I made the mistake of staring a photo album in Keep. (If you don't know, you can add photos to a note either by taking a picture or finding on on 'disk.') To my chagrin I discovered that there's no way to get these photos out of Keep.

So I was super happy when I saw that Google Takeout now exports Google Keep files. "Great!" I thought, I'll just download my whole archive and grab those files. Again, much to my chagrin, I discovered that the photos were not in the Takeout archive as JPG files, but rather encoded as base64 strings inside the html page. So for example, I have a note called "Dogs" and all the photos are base64 encoded inside that "Dogs.html" note in the Takeout archive.

This is seriously annoying.

So, I wrote a Python script to get these images out. It's called the "Keep Photo Dump."

To use it you have to have Python installed. At the terminal, you would run:
./keep_photo_dump.py Dogs.html

and all the images in the file will be dumped as Dogs1.jpg, Dogs2.jpg, etc.

Hope this helps someone else.