Image imgPhoto = Image.FromFile(ImgFile); Bitmap bmPhoto = new Bitmap(CutWidth, CutHeight, System.Drawing.Imaging.PixelFormat.Format24bppRgb);
Graphics gbmPhoto = Graphics.FromImage(bmPhoto); gbmPhoto.DrawImage(imgPhoto, new Rectangle(0, 0, CutWidth, CutHeight), PointX * imgPhoto.Width / PicWidth, PointY * imgPhoto.Height / PicHeight, CutWidth * imgPhoto.Width / PicWidth, CutHeight * imgPhoto.Height / PicHeight, GraphicsUnit.Pixel); gbmPhoto.Dispose();
if (!Directory.Exists(HttpContext.Current.Server.MapPath("/DZ/User/UserImages"))) { Directory.CreateDirectory(HttpContext.Current.Server.MapPath("/DZ/User/UserImages")); } bmPhoto.Save(HttpContext.Current.Server.MapPath("/DZ/User/UserImages/"), System.Drawing.Imaging.ImageFormat.Jpeg); imgPhoto.Dispose(); gbmPhoto.Dispose(); bmPhoto.Dispose(); System.Drawing.Image.Save 方法而导致 GDI+ 中发生一般性错误 的发生,请各位打侠帮我看下,那代码出问题了
- 2 回答
- 0 关注
- 767 浏览
添加回答
举报
0/150
提交
取消