我正在使用一种简单的Image.RotateFlip()
方法,C#
但我不断收到错误消息“内存不足”。我通过分析器运行它,发现它发生在 System.Drawing.Image.FromFile();
这是我的代码:
protected void rotatePic(object sender, EventArgs e)
{
ImageButton img = sender as ImageButton;
string url = img.ImageUrl.Split('?')[0];
System.Drawing.Image pic = System.Drawing.Image.FromFile(Server.MapPath(url));
pic.RotateFlip(System.Drawing.RotateFlipType.Rotate270FlipNone);
pic.Save(Server.MapPath(url));
pic.Dispose();
img.ImageUrl = img.ImageUrl + "?" + DateTime.Now.ToString();
}