我想旋转图像。我将我的图像保存在数据库中
var fileInDB = GetFileFromDB();
var inputStream = new MemoryStream(fileInDB.FileData); // fileInDB.FileData is Byte[]
var image = Image.FromStream(streamInput);
image.RotateFlip(RotateFlipType.Rotate90FlipNone);
image.Save(streamOut, ImageFormat.Jpeg);
SaveFileToDB(streamOut.ToArray());
图像正确旋转。但它的缩略图不旋转。它是创建拇指的代码:
var fileInDB = GetFileFromDB();
var mainImage = Image.FromStream(new MemoryStream(fileInDB.Filedata));
int thumbWidth = 100;
int thumbHeight = (thumbWidth * mainImage.Height) / mainImage.Width;
var thumbImage = mainImage.GetThumbnailImage(thumbWidth, thumbHeight, null, IntPtr.Zero);