472,796 Members | 1,600 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,796 software developers and data experts.

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("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
0 1777

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: sa | last post by:
Trying to upload a file using win xp/iis/php. I've given full access to all accounts trying to get this to work? Yet I'm still getting read errors. Simplified the script below to the bare...
13
by: Allison Bailey | last post by:
Hi Folks, I'm a brand new Python programmer, so please point me in the right direction if this is not the best forum for this question.... I would like to open an existing MS Excel spreadsheet...
13
by: puzzlecracker | last post by:
I would like to find out why exactly I wasn't able to open or execute the file.... how is it done in c++? ifsteam in("somefile"); if(!in) //why?
3
by: Andy Davis | last post by:
How do i or can I open a word document directly from Access? I would like to be able for the user to click a button on my form to open a word document and then also run a macro in Word. Thanks...
8
by: D | last post by:
Hi all .. how could one test to see if an open relay exists on a specific email server?
4
by: vithi | last post by:
Hi' I am trying to launch an application. When I try like that When I try like that Excel is opening import win32com.client object = win32com.client.Dispatch("Excel.Application") object.Visible...
3
by: John Bailo | last post by:
http://www.microsoft-watch.com/content/developer/open_source_advice_from_a_former_employee.html In the first post, Walli suggests Microsoft start by releasing the source code for SQL Server and...
12
by: Steve | last post by:
I have a database that raises an error when you try to open it and it doesn't open. Trying to open the database with the OpenDatabase method raises the same error. Trying to import any objects...
1
by: Charlie | last post by:
I am trying to make an XMLHttpRequest which violates the default "same- origin"policy in Firefox. I checked the archives and found a method that should work but it does not. Below is the test code...
1
by: yuenli | last post by:
Hi! I am facing a problem here. I wish to open a sub window from another sub window which means when i click on the main parent window a small window will appear then when i click on the button on...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: lllomh | last post by:
How does React native implement an English player?
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.