[PYTHON IMAGE-SIG] Save a 5 bit gif as a 5 bit gif?

Fredrik Lundh Fredrik Lundh" <fredrik_lundh@ivab.se
Tue, 10 Jun 1997 12:22:54 +0200


>When I save this smaller image as a GIF, PIL seems to default to using =
an =20
>8-bit palette (filling the remaining space with shades of grey) which =
has =20
>the side effect of making the smaller image about 55k - almost as big =
as =20
>the original.  As a 5-bit image, the gif is more like 15k.  However, I  =

>cannot find any obvious way of setting the bit depth that I want for =
the =20
>gif.

The problem here is not really the bitdepth, it's the LZW patentl...
 Since reaching an agreement with Unisys turned out to be
impossible (it would have meant me *and* the PIL users
 paying them for each *instance* of PIL being in use, and
also me keeping a registry of all PIL users; they also consider
all correspondence on the matter as being their property ;-),
I instead added a mechanism to write "uncompressed" GIF
files. Such files can still be read by any LZW decoder, but are,
 as you noted, very large. And using this technique only works
well with 8-bit images...

If you're on a unix platform, you can change the GifImagePlugin
to use NetPBM instead (see comments in the file for details).
Otherwise, I have no good ideas (if Netscape had cared, we'd
all be using PNG instead by now...)

Cheers /F


_______________
IMAGE-SIG - SIG on Image Processing with Python

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