我在 imageFactory.Load(inStream) 线上遇到通用 GDI+ 错误。我的项目是 ASP.NET Core Razor-Pages。
我尝试将 inStream 克隆到新流(这在之前保存位图时对我有帮助),但没有成功。
以前有人处理过类似的事情吗?
// using ImageProcessor;
// using ImageProcessor.Imaging.Formats;
byte[] photoBytes = System.IO.File.ReadAllBytes(@"C:\Users\User\Desktop\img\img.jpg");
ISupportedImageFormat format = new JpegFormat();
Size size = new Size(200,200);
using (MemoryStream inStream = new MemoryStream(photoBytes))
{
using (MemoryStream outStream = new MemoryStream())
{
var asd = inStream;
using (ImageFactory imageFactory = new ImageFactory(preserveExifData: true))
{
imageFactory.Load(inStream)
.Resize(size)
.Format(format)
.Save(@"C:\Users\User\Desktop\ImgAdjusted\");
}
}
}
根据 @itminus 的回答 - 该库不适用于 .net core。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)