[Image-SIG] Re: Loading a DDB into PIL Image

Marcus Goldfish magoldfish at gmail.com
Thu Apr 14 13:38:55 CEST 2005


> > I use ctypes to capture a device-dependent bitmap in Win32 (~600x400,
> > 32bpp), and I would like to process it using PIL.  I need a fast way
> > to convert the DDB to a PIL Image-- any solutions or suggestions
> > (ctypes, win32 solutions acceptable])?
> > "Fast" means that I need to be able to convert the image in << 1 second.
> 
> if you can convert it to a DIB, you can use the BmpImageFile.DibImageFile
> constructor.  see the ImageGrab module for sample code.
Thanks Fredrik, but I'm not sure how to convert it to DIB.

It seems like the ImageWin module is what I want to use, but it is
missing a constructor which takes a DDB bitmap and produces a DIB or
Image.  Right now, the two best solutions I can see are: (1) trying to
convert to DIB, but I'm not sure how to do this, and (2) pasting my
DDB to the clipboard then using PIL to grab it.  Any ideas on the
relative speeds of the two approaches?

Marcus


More information about the Image-SIG mailing list