Posts Tagged ‘imagemagick’

Image tiling for poster printing

May 21, 2009 4 comments

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.


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 ="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') '/tmp/im' + str(i) + '_' + str(j) + '.png' )

Then with ImageMagick:

convert -units PixelsPerInch -density 160x160 /tmp/im*.png output.pdf

Create a PDF from an image

April 23, 2008 Leave a comment

Until now I was using the Page Scaling feature of acrobat reader to print PDF file with pages of random size. I’am creating such PDF with Imagemagick:
convert myimage.png myimage.pdf
The drawbacks of this dirty methods are:

  • All pages are extend to fit the full page, which is not always what you wants
  • You may want to print from a tool which does not have the Page Scaling feature.

There is a solution in the Imagemagick documentation:
convert -units PixelsPerInch -density 150x150 myimage.png mypdf.pdf

Tags: ,