Archive

Archive for May, 2009

Image tiling for poster printing

May 21, 2009 3 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.

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

How Vista protect you against dangerous installers

May 14, 2009 1 comment

I’m using 7-zip to create simple installer for the software I develop. Many of my customers doesn’t have administrators rights and it was not a problem until recently. Vista wants adminstrator privileges to run my installers (actually a simple self extracting archive). I was wondering why Vista would require administrator privilieges to extract an archive so I tried with simple executables in Cygwin:

$ cat > foo.c
int main(void) {
   return 0;
}
$ gcc foo.c -o installer.exe
$ ./installer.exe
bash: ./installer.exe: Permission denied
$ mv installer.exe foo.exe
$ ./foo.exe

The conclusion of my errors and trials is that, on Vista, a dangerous file is a file wich contains the string instal in its name. I will just non longer name my archive foo-version-installer.exe but foo-version-inst.exe.

I’m now really looking forward to find other such easter eggs in Vista.

Categories: Uncategorized Tags:
Follow

Get every new post delivered to your Inbox.