0

我当时在保存图像时已将 imgpaths 使用到 server.mappath()
中,我在 GDI+ 错误中发生了一般错误。

            Graphics Grfx = Graphics.FromImage(bitmap);
            Grfx.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
            Grfx.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
            Grfx.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.HighQuality;
            Grfx.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
            Grfx.DrawImage(bitmap, 0, 0, wb.Width, wb.Height);

            using (Bitmap img = bitmap.Clone() as Bitmap)
            {
                Bitmap newimage = img.Clone(new System.Drawing.Rectangle(0, 0, bitmap.Width, bitmap.Height), img.PixelFormat);
                newimage.Save(imgpaths, System.Drawing.Imaging.ImageFormat.Jpeg);  //Error:A generic error occurred in GDI+.
            }



            wb.Dispose();
4

1 回答 1

1

从文件中读取图像时,只要该图像对象存在,文件就会保持打开状态。

您必须先处理原始图像对象,然后才能使用相同的文件名保存图像。

于 2012-09-01T21:06:26.683 回答