Asp.net MVC 实现图片上传剪切(7)
来源:未知 责任编辑:责任编辑 发表时间:2013-12-01 14:20 点击:次
40 }
41 }
42
43 [NonAction]
44 public static Image Crop(Image image, int width, int height, int x, int y)
45 {
46 Bitmap bmp = new Bitmap(width, height, PixelFormat.Format24bppRgb);
47 bmp.SetResolution(image.HorizontalResolution, image.VerticalResolution);
48
49 using (Graphics graphic = Graphics.FromImage(bmp))
50 {
51 graphic.SmoothingMode = SmoothingMode.AntiAlias;
52 graphic.InterpolationMode = InterpolationMode.HighQualityBicubic;
53 graphic.PixelOffsetMode = PixelOffsetMode.HighQuality;
54 graphic.DrawImage(image, new Rectangle(0, 0, width, height), x, y, width, height, GraphicsUnit.Pixel);
55 }
56
57 return bmp;
58 }
59 }
打完收工......
摘自 Yoer
相关新闻>>
最新推荐更多>>>
- 发表评论
-
- 最新评论 更多>>