我使用 nuget for c# 下载了 ImageProcessor 库。我正在使用它为网站上传和调整图像大小。上传过程工作正常,但当我尝试查看上传的图像时,它会从原始图像向后旋转 90 度。这是我正在使用的代码:
ISupportedImageFormat format = new JpegFormat { Quality = 70 };
using (MemoryStream inStream = new MemoryStream(_img))
{
using (MemoryStream outStream = new MemoryStream())
{
// Initialize the ImageFactory using the overload to preserve EXIF metadata.
using (ImageFactory imageFactory = new ImageFactory(preserveExifData: false))
{
// Load, resize, set the format and quality and save an image.
imageFactory.Load(inStream)
.Resize(new ResizeLayer(new Size(width, height), resizeMode: resizeMode))
.Format(format)
.Save(outStream);
}
return outStream.ToArray();
}
}