{
MessageShow("生成图片错误!" + ex.Message);
throw;
}
graphics.Dispose();
bitmap.Dispose();
}
// 图像压扁
protected void btnStave_Click(object sender, EventArgs e)
{
System.Drawing.Image img = System.Drawing.Image.FromFile(path);
// 宽度不变
int w = img.Width;
// 高度为原始高度的1/2
int h = img.Height / 2;
// 防止过度变形
if (w < 1) w = 10;
if (h < 1) h = 0;
bitmap = new Bitmap(w, h);
graphics = Graphics.FromImage(bitmap);
graphics.DrawImage(img, 0, 0, w, h);
try
{
bitmap.Save(Server.MapPath("./_Stave.jpg"), System.Drawing.Imaging.ImageFormat.Jpeg);
MessageShow("已经生成图片,路径为" + @Server.MapPath("./_Stave.jpg").Replace("", ""));
}
catch (Exception ex)
{
MessageShow("生成图片错误!" + ex.Message);








