lazpaint icon indicating copy to clipboard operation
lazpaint copied to clipboard

BMP file issues

Open lainz opened this issue 5 years ago • 4 comments

Hi, this attached bmp image is not displayed fine in LazPaint image.zip

Image in LazPaint imagelazpaint

Image in MsPaint imagemspaint

lainz avatar Sep 04 '20 15:09 lainz

What probably happens is that the image has the alpha value defined for some pixels and not for others. This is not an obvious one to solve. Which program produces this image?

circular17 avatar Sep 16 '20 08:09 circular17

I have no idea. I get these images at work, and as I have LazPaint as default viewer on Windows, it opens with it. It looks strange since the thumbnails was fine.

I can think this is some kind of android emulator, but is just a guess...

lainz avatar Sep 16 '20 10:09 lainz

Ok.

The BMP format is ambiguous regarding the alpha channel. So in some cases, the reader has to guess. Many image readers just consider BMP to be opaque and do not handle any alpha channel, which is why you would see it as opaque in MSPaint.

However a BMP image can be in 24-bit or in 32-bit. The file you provided is 32-bit. So it can be interpreted as having an alpha channel. Some software though use this format to store image without an alpha channel. In this case though, it is recommended to set the alpha value to zero. So the reader of BGRABitmap checks if all alpha values are in fact zero, and if that's the case, it considers the imager to be opaque.

In the file provided, I presume some pixels have an alpha channel some and some don't. In this case, it makes sense to consider the image to have an alpha channel.

There is an option in the reader to consider the image to be opaque all the time. So one way to fix the problem would be to add a setting in LazPaint to say that BMP files are always opaque. Another way would be to fix the image files, for example that the program that writes these images make sure all alpha values are set to 0.

circular17 avatar Sep 16 '20 12:09 circular17

I think is not a problem, I can open these images with mspaint, I never will edit these images. So if it's a bug of the program that made them there is no bug in LazPaint in my opinion.

lainz avatar Sep 27 '20 01:09 lainz