Last weekend I decided to push forward an idea which had wrapped around my mind for a long long time. My family (I guess as almost everyone’s) has a lot of photos, notes, documents, etc. A lot of memories, packed into albums, envelopes, frames or hidden somewhere between books on the bookshelf. Pictures fade or simply lose quality over time. That’s why I decided to scan them, but as there are a lot of them I wanted to automate the process as much as I can.
The process is simple and can be broken down into following steps:
- Insert a few pictures into a scanner. I want to scan multiple pictures at once to make the whole process faster.
- Scan using
Scan To Filebutton directly to connected computer.
- Let the script make the rest, so go to the step 1.
- Watch scanner output directory.
- If a new image, use ImageMagick to crop multiple images from it and then deskew them if needed. Move results to different watched folder for further processing.
- Convert images to jpegs and move to output directory.
- Preserve scan somewhere just in case.
Sounds easy, right? Ok, maybe except cropping images and deskewing part, but thanks to
the GoogleI found a glut of useful ImageMagick scripts. Those scripts are free, but only for non-commercial use, so mind your intentions. Of course, you have to have ImageMagick installed in the first place.
Gimmie Some Code
Node.jsmentioned in the title of this post, so Yes… I feel compelled to show some code ;). Here is script code.
fs.watchmethod gave me a big headache, that’s why I decided to go for chokidar lib.
The most important part is the usage of multicrop script. You can always modify parameters if you are not pleased with results.
.jpgis pretty straightforward.
You can find full project on Github.
I am pretty happy with results. Of course, I need to rotate pictures accordingly later.
Sometimes I need to discard a few of result pictures because of additional “subpictures” extracted from the original one. There is an option for the multi-crop script to discard images smaller than a given size. You have to be careful scanning small pictures, though.
I found Google Photos pretty robust for simple post production, including applying automatic filters and deskewing if the script doesn’t work perfectly.
Things to do
Port to Windows. I have windows machine somewhere ;]. I will update this post after it is done.
I find this approach pretty fast and good enough according to my needs. Maybe You Guys know a better and also FREE way? Let me know in the comments.