Image tiling for poster printing
Here is what I tried to print a large image (6000×4000 px) tiled on 16 A4 pages.
Jos van Eijndhoven poster
convert oisan2.png eps:- | poster -c2% -p111.76x68.58cm | ps2pdf - output2.pdf
It works but need one hour to do the conversion. I guess it’s because it work on a Postscript file.
pdfposter
It’s fast but it does not manage overlap. This is something I really need.
A tiling script with Python imaging.
#! /usr/bin/python
import Image, ImageDraw, ImageFont
im = Image.open("input.png")
ni = 4
nj = 4
imarging = 40
jmarging = 40
width=(im.size[0] + (ni-1) * 2 * imarging) / ni
height=(im.size[1] + (nj-1) * 2 * jmarging) / nj
iincr=width - 2 * imarging
jincr=height - 2 * jmarging
f = ImageFont.truetype("/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans-Bold.ttf", 25)
for i in xrange(ni):
for j in xrange(nj):
ipos = iincr * i
jpos = jincr * j
box = (ipos, jpos, ipos + width, jpos + height)
print box
thumb = im.crop(box)
d = ImageDraw.Draw(thumb)
d.text( (5,0), str(j+1) + ',' + str(i+1), font=f, fill='blue')
thumb.save( '/tmp/im' + str(i) + '_' + str(j) + '.png' )
Then with ImageMagick:
convert -units PixelsPerInch -density 160x160 /tmp/im*.png output.pdf
Categories: Uncategorized
imagemagick, pdfposter, python
Cool simple script. Note Pdfposter does do overlap…I think. Look in the patch provided here: http://pdfposter.origo.ethz.ch/node/39.
Also can you maybe mock up an html interface for your simple script and provide alternatives to using imagemagick, for instance using gd in PHP?
Thanks for the patch Paul. This worked like a charm for me!