繁体   English   中英

System.Runtime.InteropServices.ExternalException: 'GDI+ 中发生一般错误。'

[英]System.Runtime.InteropServices.ExternalException: 'A generic error occurred in GDI+.'

今天,我想用C#扫描一些二维码。 因为,为什么不呢? 所以,我正在使用 Emgu(来自 NuGet 的包),当我尝试保存图像时,我收到此错误。

System.Runtime.InteropServices.ExternalException: 'A generic error occurred in GDI+.'

这是我正在使用的代码:

Capture capture = new Capture(); //create a camera capture
Bitmap image = capture.QueryFrame().Bitmap; //take a picture
image.Save((path + "data" + i.ToString() + ".jpg").Replace(" ", "_"));

这里有什么问题?

遇到这个问题,发现通过在保存中指定格式解决了我的问题:

bmpImage.Save(filename,System.Drawing.Imaging.ImageFormat.Png);

修复一些路径错误:

string path = Path.Combine(baseDirectory, "img" + i.ToString() + ".jpg");

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM