0
我有下面的代码,它获取上传的图像并使用System.Drawing.Graphics在150 x 200 div中绘制它,但是当图像取自IOS设备图片右转90度。System.Drawing.Graphics Drawimage将从IOS获取的图片旋转到90度
仅供参考:我有同样的问题在JavaScript画布中绘制图像,并且This解决方案适用于我。因此,我要寻找一个在C#中的同类解决方案
private System.Drawing.Image ResizeAndDraw(System.Drawing.Image objTempImage)
{
Size objSize = new Size(150, 200);
Bitmap objBmp;
objBmp = new Bitmap(objSize.Width, objSize.Height);
Graphics g = Graphics.FromImage(objBmp);
g.SmoothingMode = SmoothingMode.HighQuality;
g.InterpolationMode = InterpolationMode.HighQualityBicubic;
g.PixelOffsetMode = PixelOffsetMode.HighQuality;
//Rectangle rect = new Rectangle(x, y, thumbSize.Width, thumbSize.Height);
Rectangle rect = new Rectangle(0,0,150,200);
//g.DrawImage(objTempImage, rect, 0, 0, objTempImage.Width, objTempImage.Height, GraphicsUnit.Pixel);
g.DrawImage(objTempImage, rect);
return objBmp;
}