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

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Craig

    #1

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

    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("ima ge.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("lig htbulb.bmp")
    File "C:\Python25\li b\site-packages\PIL\Im age.py", line 1730, in open
    return factory(fp, filename)
    File "C:\Python25\li b\site-packages\PIL\Im ageFile.py", line 82, in
    __init__
    self._open()
    File "C:\Python25\li b\site-packages\PIL\Bm pImagePlugin.py ", line 164,
    in _open
    self._bitmap(of fset=offset)
    File "C:\Python25\li b\site-packages\PIL\Bm pImagePlugin.py ", line 96,
    in _bitmap
    raise IOError("Unsupp orted 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("lig htbulb2.bmp")
    File "C:\Python25\li b\site-packages\PIL\Im age.py", line 1730, in open
    return factory(fp, filename)
    File "C:\Python25\li b\site-packages\PIL\Im ageFile.py", line 82, in
    __init__
    self._open()
    File "C:\Python25\li b\site-packages\PIL\Bm pImagePlugin.py ", line 164,
    in _open
    self._bitmap(of fset=offset)
    File "C:\Python25\li b\site-packages\PIL\Bm pImagePlugin.py ", line 120,
    in _bitmap
    raise IOError("Unsupp orted 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

Working...