Static planes value not equal to 1

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
picnicpete

Static planes value not equal to 1

Post by picnicpete »

Hi! I am trying to convert an image from bmp to png. It seems that the magick cannot read my bmp file. I also notice that the gimp cannot read it, but gqview and firefox are happy enough. In all cases I am using the latest up to date Ubuntu. That is, my convert version is Version: ImageMagick 6.3.7 02/19/08 Q16

The half meg image is at picnicpete.com/Frame0000000128.bmp

Code: Select all

$ convert Frame0000000128.bmp F1.png
convert: Static planes value not equal to 1 `Frame0000000128.bmp'.
convert: missing an image filename `F1.png'.
One final hint: the image was created on a Mac - does that make a difference?

So my questions are,
- am I doing something wrong?
- is the image bad?
- should i refer this to bugs forum? (And the gimp bugs as well...)
- Is there another utility on Ubuntu I could use to make my conversion?

(Many thanks for assistance)
-Picnic Pete.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Static planes value not equal to 1

Post by fmw42 »

you may want to post a link to an example image so that the IM folks can see why it is not valid. also have you tried

convert image.bmp -verbose info:

to see if tells you why it is not valid.

What app created it?
el_supremo
Posts: 1015
Joined: 2005-03-21T21:16:57-07:00

Re: Static planes value not equal to 1

Post by el_supremo »

Any definition of a windows bitmap that I can find says that the biPlanes entry in the bitmap header must have a value of one.
In your image this entry is set to zero.
the image was created on a Mac - does that make a difference?
Presumably, the Mac software you used doesn't set the biPlanes value correctly.

When I edit the file, with a hex editor, and change that value to one, IM handles the file with no problem.

Pete
el_supremo
Posts: 1015
Joined: 2005-03-21T21:16:57-07:00

Re: Static planes value not equal to 1

Post by el_supremo »

A suggestion for Magick:
In the ReadBMPImage function in coders/bmp.c where this value is checked at this code (near line 804 in the file):

Code: Select all

    if (bmp_info.planes != 1)
      ThrowReaderException(CorruptImageError,"StaticPlanesValueNotEqualToOne");
since a value of zero is meaningless, precede this with a test for zero and override it with the correct value:

Code: Select all

    if (bmp_info.planes == 0) bmp_info.planes = 1;
Pete
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Static planes value not equal to 1

Post by fmw42 »

I am using Mac OSX Tiger and have taken the rose: image from IM and converted it to png. Then I used Preview, Debabelizer, GraphicConverter to save rose.png to rose.bmp using each app. Then I went back to IM and converted each bmp file to png and it worked for all 3 of these app's bmp file.

So what app did you use on the Mac to create your bmp file?
picnicpete

Re: Static planes value not equal to 1

Post by picnicpete »

Dear fmw42,
My apologies for the URL link to my image not formatting correctly. (I have learned the preview button now.) The image is at http://picnicpete.com/Frame0000000128.bmp

-verbose info: gives only the same error message.

I don't have ready access to a Mac. The image was created by a friend who ran the app called swtsg from http://alienryderflex.com/crawl/

Many thanks for your assistance.

Dear el_supremo,

When I asked google about bmp format, he sent me to a page which is not sure what should go in that field - zero or one.
http://www.fortunecity.com/skyscraper/w ... ffrmt.html So I'm still not sure which side the bug is on. I don't know if it's a good idea for IM to be tolerant of bad input? I'm happy to leave this to the developers.

I want a command line solution to my problem, so I have done this:

Code: Select all

 printf "\001" > 1
 dd if=1 of=Frame0000000128.bmp bs=1 seek=26 conv=notrunc
And now all is good with my world. Many thanks for your assistance.

-Picnic
Post Reply