[Image-SIG] Re: PIL bit decoder

David Smith areopagus125@yahoo.com
Wed, 14 May 2003 15:25:06 -0700 (PDT)


--- Fredrik Lundh <fredrik@pythonware.com> wrote:
> try this:
> 
>     import Image
> 
>     im = Image.fromstring("F", (10,10), "*"*1000,
> "bit", 11, 0, 0, 0, 0)
> 

Fredrik,

I was puzzled by your use of 0 for the "fill"
parameter, which according to the manual will stuff
bytes into the msb end of the buffer while removing
them from the msb end.  It seems reasonable to me to
put bytes onto the msb end while extracting from the
lsb end (for a little-endian file), or put bytes on at
the lsb end and extract pixels from the msb end (for
big-endian).  I downloaded the sources and perused
BitDecode.c, and concluded that the documentation is
wrong, as are the comments in the code itself (lines
71, 74).  Fill mode 0 makes sense for a big-endian
file, and mode 3 makes sense for a little-endian file.

But I still haven't gotten to the bottom of my
problem, which occurs when reading the image in blocks
that are not full-width.

Regards,
David Smith


__________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com