62,046
社区成员
发帖
与我相关
我的任务
分享
private static System.Drawing.Bitmap ResizeImage(System.IO.Stream fileStream)
{
int maxW = Information.ReportPhotoMaxWidth;
int maxH = Information.ReportPhotoMaxHeight;
System.Drawing.Bitmap img = new System.Drawing.Bitmap(fileStream);
int w = img.Width;
int h = img.Height;
bool flag = false;
if (w > maxW)
{
flag = true;
h = maxW * h / w;
w = maxW;
}
if (h > maxH)
{
flag = true;
w = maxH * w / h;
h = maxH;
}
return flag ? new System.Drawing.Bitmap(img, w, h) : img;
}