472,799 Members | 1,751 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,799 software developers and data experts.

Opening colour BMPs with PIL

Hi there,

I'm trying to open colour BMPs using PIL and I'm getting the following
errors.

Opening a 16 colour BMP I get:
>>im = Image.open("image.bmp")
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 1901, 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 (2)
>>>

Opening a 256 colour BMP I get:
>>im = Image.open("image.bmp")
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
im = Image.open("image.bmp")
File "C:\Python25\Lib\site-packages\PIL\Image.py", line 1901, 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)
>>>

Opening a 24 bit colour BMP I get:
>>im = Image.open("image.bmp")
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
im = Image.open("image.bmp")
File "C:\Python25\Lib\site-packages\PIL\Image.py", line 1901, 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)
>>>

I am using Windows XP with Python 2.5. I can open monochrome BMPs fine
but I don't want that. If you could help that would be greatly
appreciated. Thanks and good luck.
Craig

Dec 4 '06 #1
2 4907
Craig wrote:
I'm trying to open colour BMPs using PIL and I'm getting the following
errors.
what program did you use to produce those BMP files? can you prepare
reasonably small samples using the same program and post them somewhere?

</F>

Dec 5 '06 #2
Fredrik Lundh wrote:
Craig wrote:
I'm trying to open colour BMPs using PIL and I'm getting the following
errors.

what program did you use to produce those BMP files? can you prepare
reasonably small samples using the same program and post them somewhere?

</F>
Thanks for the reply. I'm using Microsoft Paint to create the files so
that's most likely the problem (surprise, surprise). I found that by
using GIMP to create them has no problems with opening BMP images.
I'll just keep using GIMP instead.

Dec 6 '06 #3

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

Similar topics

6
by: Louise | last post by:
Hi I have written an HTML pages which does not have any colour specifying tags as far I know. When I view this in an Microsoft internet explorer browser it appears with a white background and...
3
by: Tim Marshall | last post by:
I would swear that when I developed in A97, I could change the back colour of a form. However, in Windows XP, on both A97 and A2003, there no longer is a property showing in the format tab for...
2
by: Carl Gilbert | last post by:
Hi I am looking to edit an icon at runtime on menu items such as change fill colour. I wish to replicate the features found in most applications where by the coloured bar on a colour picker...
11
by: Tim Marshall | last post by:
I use Terry Kreft's & Stephen Lebans colour dialog procedures for users to pick colours for various control properties in certain apps. Is there a way to take the colour code that is displayed in...
10
by: Pulzar | last post by:
Hi there, I want to show a simple image on a web page, and allow the viewer to select and change one of the colours used in the image, and immediately preview the result. I'd like to keep the...
20
by: Chor Lit | last post by:
Hi, I asked Bjarne Stroustrup about the idea of adding colour standard for C++, and he said that it is very difficult for compiler vendors to change their IDE. But do you think it is possible ? ...
6
Robbie
by: Robbie | last post by:
Hi. I've made 2 functions which play around with colours. They convert a 'colour number' (I don't know what the proper name for it is, so I call it this - the Long given back by RGB(),...
2
by: DumRat | last post by:
Hi, I want to run an animation(in essence). I want to draw multiple images (possibly .bmps, but I'd like other formats as well.) on to the screen each frame. I tried to do this with some C++...
17
by: mrcw | last post by:
private void timer1_Tick(object sender, EventArgs e) { Bitmap m_Undo = new Bitmap(pbLeftWebcam.Image); if (Invert(m_Undo)) ...
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
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...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
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: 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.