I’d never thought I’d be building up expertise in photo scanning and bash scripting, but here I am…

So I, like many people of my age have decades of family photos stored in photo albums and the like. Last year, I bought a new flat bed scanner for my wife to help us get this huge family collection digitized. I also spent hours with my mother (she’s 87 now) during the Christmas holidays in an assembly line kind of workflow.

My wife took all the photos out of the album and put them in a pile. I took four of them and laid them out on the bed – one photo in each corner exactly the same way. Then I set the scanner software at 600 DPI and full bed scan. It would do it’s thing depositing a new *.jpg into the folder on my desktop. We did this for hours, but never spent the time to snip the four master sheet scan into the original four photos.

Well, now I have used ImageMagick (brew install imagemagick) for Mac as a command line service. My scripting skills have been greatly enhanced while working at Staples where I’ve implemented a number of scripts for Continuous Integration and Continuous Deployment of our iOS products. So, today, I wrote a script to carve out the four images, so 75 contact sheet-like panels were processed in 11 minutes into 300 individual photos, 3″x4.54″ and at 300 dpi.

Here’s the juicy part of the script:
picFiles=(*.jpg)
for f in "${picFiles[@]}"; do
echo "$f"
b=${f%.*}
convert $f -density 300 -units PixelsPerInch -crop 2324x3516+5+5 -resize 900x1362 $b-1".png"
convert $f -density 300 -units PixelsPerInch -crop 2324x3516+2818+0 -resize 900x1362 $b-2".png"
convert $f -density 300 -units PixelsPerInch -crop 2324x3516+0+3600 -resize 900x1362 $b-3".png"
convert $f -density 300 -units PixelsPerInch -crop 2324x3516+2818+3600 -resize 900x1362 $b-4".png"
done

Then, I reviewed each photo and flipped them accordingly.

My plan is to collect all my photos into a giant DVD library so my kids can each have a set. Who knows, maybe for Christmas 2018?

Related Post