Saturday, 29 January 2011

QSL Cards

At the shack there are thousands of QSL cards stuffed into boxes. As an experiment I decided to see if there was a quick way of scanning these - so using a webcam to capture a still image, followed by a python script to stitch the 2 adjacent images together (as the front and back will be on 2 separate images) I managed 400 or so in a session.

stuffed up on flickr for now till I get round to finding a better place for em.

oh the script? it's my 1st adventure into the Python Imaging Library -- and its rather nice.


# Script to generate a single image of a QSL card from 2 adjacent
# scanned images
# Andrew Elwell for F6KAR
# This script may be copied or modified under the terms of the GPL
# We assume that the cards are arranged with the following seq:
# [- 1F] [1R 2F] [2R 3F] .... where FR are Front and Rear of cards

from PIL import Image
import os

indir = "/home/aelwell/Downloads/qsl/batch2"
outdir = "out/"

#leftbox = (100,100,900,1200)
leftbox = (0,0,750,1000)
rightbox = (850,0,1600,1000)

#todo = os.listdir(indir)
#todo = list(todo)
#for i in todo:

for n in range(1,403):
i = "Image-" + str(n) + ".jpg"
image = + "/" +i)
print i

merge ='RGB',(1000,1500),)

print "should skip on 1st iteration"

rear = image.crop(leftbox)
rear = rear.rotate(90)


front = image.crop(rightbox)
front = front.rotate(270) + i,"JPEG")

No comments:

Feeling Pumped!

Having just had a day without power, and then going round the site to check everything came back online correctly (including services such a...