Closed mayeut closed 7 years ago
Thanks for this, but I haven't decided what to do about it. The equivalent PNG file does seem to work, but I'm not sure I understand chromaticities well enough to know if this is a legitimate thing to do. And I wonder if swapping red/blue might be safer than red/green.
Another issue is that I'd rather not create any more BMPv4 files until I know that I have the gamma fields set correctly. In fact, I just found something that suggests I guessed wrong, and the gamma should be 2.2 instead of 1/2.2.
The only "information" I found is ImageMagick implementation which suggest 1/2.2
https://github.com/ImageMagick/ImageMagick/blob/4cc6ec8a4197d4c008577127736bf7985d632323/coders/bmp.c#L759 Compared to their PNG implementation https://github.com/ImageMagick/ImageMagick/blob/4cc6ec8a4197d4c008577127736bf7985d632323/coders/png.c#L2589
But this is just one implementation...
There's a Petzold book that suggests 0x23333 (2.2) as a possible gamma value. Try a web search for the terms: BITMAPV4HEADER 0x23333
I decided against this, for now. I'd want to get expert advice first.
This image has red & green channels swapped. The color calibration from v4 header tries to swap them back. Classified as questionnable given the comment regarding gamma & chromaticity.
Firefox, Safari & Chrome are failing to display this correctly. When writing calibration information from this BMP in a PNG file (cHRM & gAMA chunks), channels are swapped & displayed properly.