Page 1 of 1

Can't read transparent BMP images

Posted: 2012-11-21T10:06:24-07:00
by Jason S
Version 6.8.0-4 supports the transparency in the these BMP images: rgba16-4444.bmp rgba32.bmp, but 6.8.0-5 does not.

Here's what changed in the code:

Code: Select all

6.8.0-4:coders/bmp.c:846

    image->matte=(bmp_info.alpha_mask != 0) ||
      ((bmp_info.compression == BI_RGB) && (bmp_info.bits_per_pixel == 32)) ?
      MagickTrue : MagickFalse;

6.8.0-5:

    image->matte=(bmp_info.alpha_mask != 0) &&
      ((bmp_info.compression == BI_RGB) && (bmp_info.bits_per_pixel == 32)) ?
      MagickTrue : MagickFalse;
I suggest this instead:

Code: Select all

    image->matte=(bmp_info.alpha_mask != 0) &&
      (bmp_info.compression == BI_BITFIELDS) ?
      MagickTrue : MagickFalse;
Although Microsoft's documentation implies that the alpha_mask field is valid for BI_RGB images, it also says what all the bits are used for, and leaves none of them available for an alpha mask. If you want to try to allow some BI_RGB images to have transparency, I wouldn't object, but I don't think it's necessary, and it would have to be done very carefully.

Re: Can't read transparent BMP images

Posted: 2012-11-23T14:07:29-07:00
by glennrp
Jason, "magick" committed your patch at SVN revision 10011; it will appear in IM-6.8.0-6.