jsummers / bmpsuite

A set of Windows BMP image files, for testing purposes
https://entropymine.com/jason/bmpsuite/
GNU General Public License v3.0
55 stars 16 forks source link

What's about 64-bit bitmaps #17

Closed midoragh closed 8 months ago

midoragh commented 2 years ago

There is just a little bit information about this format (https://docs.microsoft.com/en-us/windows/win32/wic/-wic-codec-native-pixel-formats) but I'm able to create a 64-bit BMP file in c# by creating 64-bit bgra Bitmap, draw a 32-bit bgra Bitmap on it and save it as bmp. The resulting file uses a BITMAPINFOHEADER with a bitcount of 64. The pixels are a bit special. All 16-bit channel values are fixed point values in the format s2.13: (sign bit, two integer bits, and thirteen fractional bits). These files seem to work with any application using WIC (like the FileExplorer, Photo, paint.net). Would it make sense to add such files to the bmpsuite?

jsummers commented 2 years ago

Thanks for the information. I've been aware of the existence of 64-bit BMP extensions, but not sure how standard they are, or if anyone uses them in files.

I think I do want to add some 64-bit files to bmpsuite, but it might not happen soon, and I don't know what issues I might run into. If you can point me to some example files, it might help.

midoragh commented 2 years ago

The attached bmp has been created using the following code

        var rgb24Bitmap = new Bitmap(@"C:\Users\ZZZ\Downloads\bmpsuite-2.7\g\rgb24.bmp");
        var argb64Bitmap = new Bitmap(rgb24Bitmap.Width, rgb24Bitmap.Height, PixelFormat.Format64bppArgb);
        using (var gr = Graphics.FromImage(argb64Bitmap))
        {
            gr.DrawImage(rgb24Bitmap, new Rectangle(0, 0, rgb24Bitmap.Width, rgb24Bitmap.Height));
        }
        argb64Bitmap.Save(@"C:\Users\ZZZ\Downloads\bmpsuite-2.7\g\argb64.bmp", ImageFormat.Bmp);

argb64.zip

In the FileExplorer rgb24.bmp and argb64.bmp are looking the same. But if I'm doing the mapping of the values in the range 0.0..1.0 to 0..255 manually and save it as rgb 24 then the image is darker. So 64bit may not be in sRGB (or I'm doing something wrong).

pkasting commented 8 months ago

Can be closed?

jsummers commented 8 months ago

Closing. Issue #21 might stay open until I decide what do do about transparency.