Any suggestions to speed this up

MetalOne jcb at iteris.com
Sat Nov 8 19:01:07 EST 2003


Thanks.
Your suggestion worked with a slight tweak to the code.

def buildBitmap2(rawData, w, h):
    im = Image.fromstring("L", (w, h), rawData)
    im = im.convert("RGB")
    file = cStringIO.StringIO()
    im.save(file, "PPM")
    file.seek(0)
    return wxBitmapFromImage(wxImageFromStream(file) )

On my home computer, my frame rate went from 7fps to 27fps.
I had glanced at PIL earlier in the week and did not think it would
work.  Your post gave me some confidence that it would, so I looked
into it a little more.  PIL looks to be quite cool.

I tried getting your second suggestion with the Dibs to work, but I
can't seem to make them work with wxWindows.  I can't get access to
the underlying device context handle.

I also tried playing around with Array('c') and numarray.  Iterating
over these sequences was no faster than with list.  At least, it did
not change the frame rate.




More information about the Python-list mailing list