System.Drawing.Bitmap map = new Bitmap(Server.MapPath( " 2008.jpg " )); // 调整图片的长短比 double dl; double maxlength = 400 ; if (map.Width >= map.Height) { dl = (double)(maxlength / (double)map.Width);//求比例 } else { dl = (double)(maxlength / (double)map.Height); } // 构建新的图片 System.Drawing.Bitmap newmap = new Bitmap(map,( int )(map.Width * dl),( int )(map.Height * dl)); Response.Clear(); // 图片写入流中 newmap.Save(Response.OutputStream,System.Drawing.Imaging.ImageFormat.Jpeg); // 释放内存 map.Dispose(); newmap.Dispose(); Response.End(); 转载于:https://www.cnblogs.com/cooolbin/archive/2008/03/01/1087190.html