Convert PNG files to BMP files using PIL

Fredrik Lundh fredrik at pythonware.com
Mon Dec 4 17:17:24 EST 2006


Craig wrote:

> I'm trying to convert some PNG files to bitmap files which can then be
> converted to X11 bitmaps using the im.tobitmap() function.  But the
> error I get when using the im.tobitmap() function on the PNG files I
> get the following error:
> 
>>>> im.tobitmap()

tobitmap() only works for mode "1" images.  if you have something else, 
you need to map it to black & white first, e.g.

 >>> im.convert("1").tobitmap()
 >>> im.convert("1", dither=Image.NONE).tobitmap()
 >>> im.point(table, "1").tobitmap()

etc.

</F>




More information about the Python-list mailing list