Convert PNG files to BMP files using PIL

C

Craig

Hi there,

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:

Traceback (most recent call last):
File "<pyshell#2>", line 1, in <module>
im.tobitmap()
File "C:\Python25\Lib\site-packages\PIL\Image.py", line 545, in
tobitmap
raise ValueError("not a bitmap")
ValueError: not a bitmap
Can this be done using PIL or is there another library that can be used
to fulfil the task. If you could let me know that would be great.
Thanks and good luck.


Craig
 
F

Fredrik Lundh

Craig said:
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:

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

etc.

</F>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,818
Latest member
Brigette36

Latest Threads

Top