输入图像在加载过程中丢失了 PixelFormat。 C#
The input image lost its PixelFormat during the loading process. c#
我想从我的资源中将图像加载到位图中,并保存其像素格式。输入图像是具有 8 BitsPerPixel 图像深度的 .bmp 文件。这是代码:
Bitmap inputImage = new Bitmap(Test.Resources.sourceImage);
当我调试程序并检查sourceImage 的属性时,它的PixelFormat 是PixelFormat.Format8bppIndexed
。
但是在这个变量赋值之后,inputImage 的 PixelFormat 是 Format32bppArgb
.
你知道问题出在哪里吗?
var source = Test.Resources.sourceImage;
Bitmap inputImage = source.Clone(new Rectangle(Point.Empty, source.Size), source.PixelFormat);
我想从我的资源中将图像加载到位图中,并保存其像素格式。输入图像是具有 8 BitsPerPixel 图像深度的 .bmp 文件。这是代码:
Bitmap inputImage = new Bitmap(Test.Resources.sourceImage);
当我调试程序并检查sourceImage 的属性时,它的PixelFormat 是PixelFormat.Format8bppIndexed
。
但是在这个变量赋值之后,inputImage 的 PixelFormat 是 Format32bppArgb
.
你知道问题出在哪里吗?
var source = Test.Resources.sourceImage;
Bitmap inputImage = source.Clone(new Rectangle(Point.Empty, source.Size), source.PixelFormat);