python image library making dotty gifs

Alex Hunsley lard at
Fri Jun 25 16:24:27 CEST 2004

Oliver Fromme wrote:
> Alex Hunsley <lard at> wrote:
>  > I'm using python image library 1.1.4 ( 
>  > to plot images.
>  > However, when I save an image to a gif file, it comes out very dotty/ithered 
>  > looking, even if it's a picture consisting only of one colour!
>  > [...]
>  > im ="RGB", (imageWidth, imageHeight))
>  > [...]
>  >"plotImage.gif", "GIF")
> You're creating an RGB image (i.e. 24 bits per pixel), and
> then you're saving it to a GIF file which can handle only
> 8 bits per pixel.  The GIF file format uses a so-called
> palette to map 24bit RGB colors to 8 bits.  You haven't
> defined any palette, so I guess it's using a default one,
> to which it has to convert your image, obviously involving
> dithering.
> I'm not a PIL user, so I can't tell you how to define your
> own optimized palette with it.
> Another option would be to save the image in PNG format,
> which supports 24bits natively.
> Best regards
>    Oliver
aha! ok. thanks to you and steve for your help! :)

More information about the Python-list mailing list