help debugging noob code - converting binary data to images...

larry at larry at
Mon Jun 30 05:47:01 CEST 2008

success, had to fill in a few blanks with some more googling, here is
the finished script  (used all for loops this time, saved a few more



import string
import Image, ImageDraw

size = 2

im ="1",[8*size,8*size],1)
draw = ImageDraw.Draw(im)

cset  = open("chargen","r")

for cchar in range(0, 512, 1):
    for charline in range(0, 8, 1):
        x =
        ch = ord(x)
        for position in range(0, 8, 1):
            if ch & ( 2 ** position ):
                xp = (7-position)*size
                yp = charline*size
fill=0 )
    outfile = "/home/mydir/work/char"+string.zfill(cchar,3)+".png","png")


It does the variable sizes like I wanted and it now sure is fast.

If I wanted to display an image without saving how do I do that, on
the image module it does not pop up a canvas..  the on the
bottom does not seem to work.

Thanks again!

More information about the Python-list mailing list