PIL Gotcha maybe?

Robin Becker robin at jessikat.fsnet.co.uk
Wed May 2 13:47:53 EDT 2001


In article <UXWH6.11626$4N4.2471355 at newsc.telia.net>, Fredrik Lundh
<fredrik at pythonware.com> writes
>Robin Becker wrote:
>> >It looks dithered.  I presume that by default the GIF PIL plugin uses
>> >the Web palette; your color isn't exactly represented in that palette,
>> >so it's dithering it in the output.
>> >
>> I thought so too, but dithering isn't done to BMP, TIFF etc and I've no
>> idea how to turn it off.
>
>BMP, TIFF, etc support 24-bit truecolor images ("RGB").
>GIF doesn't, so it converts the image to "P" on the way
>out.
>
>adding this line before im.save might work (untested):
>
>    im = im.convert("P", dither=Image.NONE, palette=Image.ADAPTIVE)
>
>Cheers /F
>
>
That seems much better and even my anti-aliased images are reasonable. I
guess they'll use up my colours pretty quickly. Is there any docco for
the various palette/dither controls? 
-- 
Robin Becker



More information about the Python-list mailing list