Replies: 4 comments 3 replies
-
I do not believe skia supports a 24-bit color type. It supports reading 8-bit, 16-bit and 32-bit colors and a few floating point colors. I believe pixel sizes are for optimizing memory operations with either 1, 2 or 4 bytes. 3 bytes are a bit harder to copy and things like that. You might find that you get better performance with a single load and then faster operations vs a quick load and then all operations need additional math. I would suggest asking on the skia engine discussion site for details on this: https://groups.google.com/g/skia-discuss |
Beta Was this translation helpful? Give feedback.
-
You could use SIMD intrinsics to do a performant conversion? Unfortunately you don't find a lot of examples in C#, but most of the code can be easily converted from the C++ code. For example https://github.com/ermig1979/Simd/blob/master/src/Simd/SimdSse41BgrToBgra.cpp Or you just interop to the native code with DllImport, maybe even using the new C# native delegates ;-) If done well, you can really achieve C++ like SIMD performance these days in .NET! |
Beta Was this translation helpful? Give feedback.
-
24 bit support would be really useful! I would love to see it added at some point. Thanks. |
Beta Was this translation helpful? Give feedback.
-
Even if there's no way to work on the image in 24 bits format, is there any way to save it as 24 bits losslessly? |
Beta Was this translation helpful? Give feedback.
-
I am trying to get some pixel data into an
SKImage
orSKBitmap
for drawing it to a canvas without having to perform an expensive copy to a 4 channel format or encoding/decoding the image. This pixel data is the same format that aSystem.Drawing.Bitmap
withPixelFormat.Format24bppRgb
uses. It seems thatSKImageInfo
is not able to represent this pixel format though.Here is the line I'm using to make my SKImageInfo:
This results in an SKImageInfo that has
BytesPerPixel = 4
.I can't find any other color type that would match this pixel format with 3 bytes per pixel, even though this is a very common format that .bmp files store internally. (BGR vs RGB aside)
Are 24bpp RGB/BGR bitmaps not supported?
Is there a way to construct an SKImageInfo that has
BytesPerPixel = 3
and its other properties with the specific values I need?Beta Was this translation helpful? Give feedback.
All reactions