Your browser does not seem to support JavaScript. As a result, your viewing experience will be diminished, and you have been placed in read-only mode.
Please download a browser that supports JavaScript, or enable it if it's disabled (i.e. NoScript).
Hi,
I need to store a grayscale bitmap with high precision, so it needs to be 32bit.
this is the code I use to create the BaseBitmap:
maxon::Result<BaseBitmap*> MyClass::GetBitmap() { iferr_scope; AutoAlloc<BaseBitmap> bitmap; const Int32 pixelBytes = COLORBYTES_GRAYf; const Int32 pixelBits = pixelBytes * 8; if (bitmap->Init((Int32)_width, (Int32)_height, pixelBits, INITBITMAPFLAGS::GRAYSCALE) != IMAGERESULT::OK) return maxon::OutOfMemoryError(MAXON_SOURCE_LOCATION, "Could not initialize BaseBitmap!"_s); Float32 *buffer = NewMemClear(Float32, _width) iferr_return; for (Int z = 0; z < _height; ++z) { for (Int32 x = 0; x < _width; ++x) { buffer[x] = (Float32)GetSomeMagicGrayscaleValue(); } bitmap->SetPixelCnt(0, (Int32)z, (Int32)_width, (UChar*)buffer, COLORBYTES_GRAYf, COLORMODE::GRAYf, PIXELCNT::NONE); } DeleteMem(buffer); return bitmap.Release(); }
And here is how I save the file:
bmp->Save(fn, FILTER_TIF, nullptr, SAVEBIT::USE32BITCHANNELS);
The file is created, and when I open it in Preview.app (I'm on macOS, obviously), the bitmap is correctly displayed. Nice! However, if I simply select it in the Finder, the preview never appears, the spinning dots stay there forever. Also, the created file seems to be the only image file on my computer that has the default bitmap icon.
I guess, something needs to be changed in my code. Or is macOS simply not able to display previews of 32bit grayscale images, even though Preview.app can do it?
Greetings, thanks for tips, Frank
I somehow doubt, that there is something in your code, that is the reason for the problem, given how high-level the bitmap format interface of BaseBitmap is. So the remaining question would be: Is it MAXON's or Apple's fault? My answer is probably not what you are looking for, but it should address some problems:
BaseBitmap
Cheers, zipit
Hi Frank, I confirm that it's a flaw of macOS. Creating a 32-bit grayscale image with an image-editing software and pressing the space-bar on the selected image just ends up with the same results.
Cheers,
Ah, great, thank for checking! Then I don't need to worry about my bmp code
Cheers, Frank