Page 1 of 1

Unable to convert certain bmps

Posted: 2010-05-21T11:25:50-07:00
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.

Re: Unable to convert certain bmps

Posted: 2010-05-21T11:39:37-07:00
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.

Re: Unable to convert certain bmps

Posted: 2011-03-14T07:36:16-07:00
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

Re: Unable to convert certain bmps

Posted: 2011-03-14T08:04:02-07:00
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.