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.
#!/usr/bin/python
# Script to generate a single image of a QSL card from 2 adjacent
# scanned images
#
# Andrew Elwellfor 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)
#todo.sort()
#for i in todo:
for n in range(1,403):
i = "Image-" + str(n) + ".jpg"
image = Image.open(indir + "/" +i)
print i
merge = Image.new('RGB',(1000,1500),)
try:
merge.paste(front,(0,0,1000,750))
except:
print "should skip on 1st iteration"
rear = image.crop(leftbox)
rear = rear.rotate(90)
merge.paste(rear,(0,750,1000,1500))
front = image.crop(rightbox)
front = front.rotate(270)
merge.save(outdir + i,"JPEG")
No comments:
Post a Comment