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;
}