Closed IYinxf closed 4 years ago
Sorry, somehow I missed this issue up to now.
As GetBitsPerPixel
extracts the BPP value directly from PixelFormat
(see ToBitsPerPixel
) the result for Format8bppIndexed
is guaranteed to be 8.
Do you still have the issue? A sample image might help; otherwise, I only can imagine the following gotchas:
You can load your image
by Imaging Tools to see how the decoders used by System.Drawing
treat the image. If you see Format8bppIndexed
there, then GetBitsPerPixel/ToBitsPerPixel
extensions must return 8.
Image image = Image.FromFile(fileName); image.GetBitsPerPixel();
Even if the PixelFormat of file information is Format8bppIndexed, the return here is still 32. It is necessary for me to judge it. What should I do?