/// <summary>
/// 剪裁图片
/// </summary>
/// <param name="src">原图片</param>
/// <param name="left">左坐标</param>
/// <param name="top">顶部坐标</param>
/// <param name="right">右坐标</param>
/// <param name="bottom">底部坐标</param>
/// <returns>剪裁后的图片</returns>
public Image CutImage(Image src, int left, int top, int right, int bottom)
{
Bitmap srcBitmap = new Bitmap(src);
int width = right - left;
int height = bottom - top;
Bitmap destBitmap = new Bitmap(width, height);
using (Graphics g = Graphics.FromImage(destBitmap))
{
g.Clear(Color.Transparent);
//设置画布的描绘质量
g.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
g.DrawImage(srcBitmap, new Rectangle(0, 0, width, height), left, top, width, height, GraphicsUnit.Pixel);
}
return destBitmap;
}
var code = "0d3af3a9-067c-472f-9f2f-1d8dd6d288c4"