作者:花痴-耐你们_304 | 来源:互联网 | 2024-09-30 17:05
Iusedtousethiscodetoresizetheuploadedimage,butwhenIcomparedthegeneratedimagewitho
I used to use this code to resize the uploaded image, but when I compared the generated image with other images in other websites, I found that It have large size !!
我曾经使用这段代码来调整上传的图像大小,但是当我将生成的图像与其他网站中的其他图像进行比较时,我发现它有大尺寸!!
System.Drawing.Image img = System.Drawing.Image.FromFile(MapPath(filePath));
int mediumWidth = 350;
int mediumHeight = mediumWidth * img.Height / img.Width;
System.Drawing.Bitmap bmw = new System.Drawing.Bitmap(img, mediumWidth, mediumHeight);//resize image
bmw.Save(MapPath("~/image/thumb/") + fileName);
bmw.Dispose();
the generated image have 200 Kb, but in other websites it have 20 kb.. Is there a problem with my code ?
生成的图像有200 Kb,但在其他网站上它有20 kb ..我的代码有问题吗?
1 个解决方案