我遇到了以下错误:
"无法从具有索引像素格式的图像创建 Graphics 对象。"
发生在以下函数中:
public static void AdjustImage(ImageAttributes imageAttributes, Image image)
{
Rectangle rect = new Rectangle(0, 0, image.Width, image.Height);
Graphics g = Graphics.FromImage(image);
g.InterpolationMode = InterpolationMode.HighQualityBicubic;
g.DrawImage(image, rect, 0, 0, image.Width, image.Height, GraphicsUnit.Pixel, imageAttributes);
g.Dispose();
}
我想询问你,我该如何修复它?
Dim rect As New System.Drawing.Rectangle(0, 0, bm.width, bm.height) : g.DrawImage(bm, rect, 0, 0, bm.width, bm.Height, GraphicsUnit.Pixel)
。 - rg89Bitmap Clone(Rectangle rect, PixelFormat format)
- Mauro Raymondi