[Image-SIG] uchar pointer to image

W. John neojohn75 at yahoo.com
Wed Jun 1 17:46:03 CEST 2005


Hi!
  This is a newbie question about PIL and Python. If I
have a shared character array (buffer) that is
allocated in a C++ class using "mmap".  A function
called 'Capture' returns a pointer to that shared
area, and after a wrapper for Python I'm doing
something like this:
   >data=mycam.Capture()
   >print data
   _0810cdbe_p_uchar

How can I convert "data" (the uchar pointer) to an PIL
image?  Do I need to use the "fromstring" fuction?  I
tried something like this but is not working.
   >image=Image.new("L",(640,480))
   >image.fromstring(data)

What I'm doing wrong?

Thanks.
--John



		
__________________________________ 
Discover Yahoo! 
Use Yahoo! to plan a weekend, have fun online and more. Check it out! 
http://discover.yahoo.com/


More information about the Image-SIG mailing list