Unable to convert certain bmps

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
Wisp

Unable to convert certain bmps

Post by Wisp »

ImageMagick (6.6.1-10) seems unable to convert certain BMP files, giving the error "insufficient image data in file [...] @ error/bmp.c/ReadBMPImage/869"

The images are screenshots from the game Baldur's Gate II. If one of the troublesome BMPs is converted into another format by another program and back into BMP, ImageMagick can convert it. I assume there's something wonky, or non-standard, or whatever about these files. Is there anything that can be done about it?

I've added 3 files to a zip archive and made it available here.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Unable to convert certain bmps

Post by magick »

We can reproduce the problem you posted and have a patch in ImageMagick 6.6.2-0 Beta available by sometime tomorrow. Thanks.
pipipi
Posts: 1
Joined: 2011-03-14T07:22:23-07:00
Authentication code: 8675308

Re: Unable to convert certain bmps

Post by pipipi »

I have a similar problem. Bitmap is there: http://www.sendspace.com/file/korkhv

With version 6.6.7-7 (sources):
$ convert in.bmp -resize 185x163 out.jpg
convert: insufficient image data in file `in.bmp' @ error/bmp.c/ReadBMPImage/918.
convert: missing an image filename `out.jpg' @ error/convert.c/ConvertImageCommand/2959.
$ convert -version
Version: ImageMagick 6.6.7-7 2011-02-18 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2011 ImageMagick Studio LLC
Features:
With version 6.6.2-6 (ubuntu):
$ convert -resize 185x163 in.bmp out.jpg
convert: insufficient image data in file `in.bmp' @ error/bmp.c/ReadBMPImage/913.
convert: missing an image filename `out.jpg' @ error/convert.c/ConvertImageCommand/2970.
$ convert -version
Version: ImageMagick 6.6.2-6 2010-12-02 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2010 ImageMagick Studio LLC
Features: OpenMP
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Unable to convert certain bmps

Post by magick »

You bitmap is corrupt. For security reasons, ImageMagick will not decode a corrupt image. To confirm we used the bmptopnm utility and it returns:
  • -> bmptopnm out.bmp
    bmptopnm: Windows BMP, 1680x1050x32
    bmptopnm: warning: the BMP header says the raster starts at offset 58 bytes into the file (offbits), but that there are 54 bytes of information before the raster. This inconsistency probably means the input file is not a legal BMP file and is unusable.
    bmptopnm: End of file reading row 0 of BMP raster.
Post Reply