Jonathan Green Posted October 4, 2020 Share Posted October 4, 2020 I'm writing a BMP file from my app and trying to open it in .Net (4.2.13). I'm using the same DIB header format as is written by .Net (BITMAPV5HEADER). .Net specifies the RGBA channel masks in the header as R = 0x00ff000, G = 0x0000ff00, B = 0x000000ff, A = 0xff000000. When I write these masks to my header, .Net reads the file correctly, but my pixel data is in a different order, the red and blue colors are swapped. But the alpha channel is correct. If I change the header mask to get the correct color order [R = 0x0000000ff, B = 0x00ff0000], the colors come in the correctly, but the alpha channel data is ignored and all pixels have alpha 255. I can read my correct order BMP file into InkScape and it works fine, with the alpha channel correct. So this seems to be a .Net bug. I'm using all the other settings exactly as written by .Net, so DIB header bV5Compression is 3 (BI_BITFIELDS). If I hand edit a BMP file written by .Net to just swap the red and blue masks the same thing happens. When I open the edited BMP file in .Net, the alpha channel data is ignored and all texels have alpha = 255. Quote Link to comment Share on other sites More sharing options...
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.