Extracting all images from an Evernote Export (.enex) file

While it’s quite easy to get a large number of images into an Evernote note, it’s hard work to get them all out again: you have to right-click them one by one, then “Save as…” each one.

However, Evernote does let you export the entire note ‒ and even several notes at once ‒ into one .enex file. .enex files are XML, with each image base64 encoded and neatly enclosed in a <resource> tag. So here is a perl script that will take a list of .enex files as command line arguments, and write all the images from each of them to the current folder.