[IMAGE-SIG] Creating a new Image object from C code

Andrew Kuchling amk@magnet.com
Wed, 18 Jun 1997 14:02:37 -0400 (EDT)


I'm working on a PIL/SANE interface, and am wondering how I should
create a new Image object in C code, to be returned as the scanner's
output.

There's the .putdata() image method, which wants a sequence object
containing the pixel data.  However, the SANE interface works in
chunks (the processing loop looks like this:

  st=SANE_STATUS_GOOD;
  while (st!=SANE_STATUS_EOF)
    {
      st=sane_read(self->h, buffer, 8192, &len);
      if (st && st!=SANE_STATUS_EOF) return PySane_Error(st);
      /* XXX Do something with the len bytes of data in buffer[] */
    }
 
) and I'm wondering if I have to accumulate all the data until the
whole frame is done.  That's probably not optimal, since an 8.5x11
page, scanned at 300dpi, takes a lot of room.  

	Andrew Kuchling
	amk@magnet.com
	http://people.magnet.com/%7Eamk/


_______________
IMAGE-SIG - SIG on Image Processing with Python

send messages to: image-sig@python.org
administrivia to: image-sig-request@python.org
_______________