By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,050 Members | 1,009 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,050 IT Pros & Developers. It's quick & easy.

Open 16-bit/24-bit windows bitmap using PIL

P: n/a
Hi there,

I'm trying to open a 256-colour windows BMP and a 24-bit windows BMP
with PIL usiing the following command:

Image.open("image.bmp")

When I try and open the 24-bit BMP the error I get is:

Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
im = Image.open("lightbulb.bmp")
File "C:\Python25\lib\site-packages\PIL\Image.py", line 1730, in open
return factory(fp, filename)
File "C:\Python25\lib\site-packages\PIL\ImageFile.py", line 82, in
__init__
self._open()
File "C:\Python25\lib\site-packages\PIL\BmpImagePlugin.py", line 164,
in _open
self._bitmap(offset=offset)
File "C:\Python25\lib\site-packages\PIL\BmpImagePlugin.py", line 96,
in _bitmap
raise IOError("Unsupported BMP header type (%d)" % len(s))
IOError: Unsupported BMP header type (108)

When I try and open the 256-colour BMP the error I get is:

Traceback (most recent call last):
File "<pyshell#3>", line 1, in <module>
im = Image.open("lightbulb2.bmp")
File "C:\Python25\lib\site-packages\PIL\Image.py", line 1730, in open
return factory(fp, filename)
File "C:\Python25\lib\site-packages\PIL\ImageFile.py", line 82, in
__init__
self._open()
File "C:\Python25\lib\site-packages\PIL\BmpImagePlugin.py", line 164,
in _open
self._bitmap(offset=offset)
File "C:\Python25\lib\site-packages\PIL\BmpImagePlugin.py", line 120,
in _bitmap
raise IOError("Unsupported BMP compression (%d)" % compression)
IOError: Unsupported BMP compression (1)

I can open a windows monochrome bitmap fine using PIL but the colour
options are more desirable. I am using Windows 2000 if that is any
help and I am saving the different BMP's using Microsoft Paint. If you
could help that would be great.
Craig

Dec 1 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.