BMP distorted when viewing/converting

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
kovidgoyal
Posts: 2
Joined: 2012-02-17T08:21:27-07:00
Authentication code: 8675308

BMP distorted when viewing/converting

Post by kovidgoyal »

The following BMP file is distorted when viewing with display or converting with convert to png. It views correctly in firefox and gwenview (which uses the Qt image reading plugins). ImageMagick 6.7.5.3 on 64bit linux.

http://kovidgoyal.net/test.bmp

When converted by ImageMagick to png with convert test.bmp test.png it looks like:

http://kovidgoyal.net/test.png

The image appears to have been wrapped around the canvas. The same bmp image display correctly with either Qt or firefox.

Thanks.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: BMP distorted when viewing/converting

Post by magick »

With bmptoppm we get
  • bmptoppm: Windows BMP, 300x500x8
    bmptoppm: warning: the BMP header says the raster starts at offset 40 bytes into the file (offbits), but that there are 1078 bytes of information before the raster. This inconsistency probably means the input file is not a legal BMP file and is unusable.
    bmptoppm: broken.bmp: read error
If we override the BMP offbits of 40 and set it to 1078, we get the expected results.

It appears your image is corrupt. Do you have any reason to believe otherwise?
kovidgoyal
Posts: 2
Joined: 2012-02-17T08:21:27-07:00
Authentication code: 8675308

Re: BMP distorted when viewing/converting

Post by kovidgoyal »

It's generated by Microsoft Word and is correctly interpreted by: Word, wordpad, openoffice, firefox, gwenview (any program based on the Qt toolkit). It is incorrectly interpreted by imagemagick, bmptoppm and gimp. It may well be corrupted, given that it's a Microsoft format, I'd say its natural state is to be corrupted, but lots of programs accept it and display it correctly. Whether you wish to do so in ImageMagick is entirely up to you, of course :)
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: BMP distorted when viewing/converting

Post by fmw42 »

For what it is worth, I can display it on my Mac OSX Snow Leopard in Photoshop CS3 but it is wrapped like the png image. Mac Preview says it is corrupt and won't display it. However, GraphicConverter displays it correctly.
Post Reply