C# Image对象的GetThumbnailImage方法,为什么缩略图的容量反而更大了?

来源:百度知道 编辑:UC知道 时间:2024/06/20 17:05:53
Image image = Image.FromFile(MyServer.MapPath("photo/big/" + tempFileName));
Image newimage = image;
Image.GetThumbnailImageAbort gia = null;
newimage = image.GetThumbnailImage(400, 400, gia, new System.IntPtr());
newimage.Save(MyServer.MapPath("photo/small/" + tempFileName));
}
原本的图片是 1280*760的,转换成400*400 反正容量更大,这是为什么?怎么解决啊?
还是不行哦,图像变小了是真的,可是本来几十K的,变小了以后就一百多K了~~ 格式没有变啊,有什么办法能绕过这个问题也行~

可以自己画一个小图
Image newImage = new Bitmap(400,400);
Graphics g = Graphics.FromImage(newImage);
g.DrawImage(image,new Rectangle(0,0,400,400),new Rectangle(0,0,image.Width,image.Height,GraphicsUnit.Pixel));
g.Disponse();
newImage.Save(MyServer.MapPath("photo/small" + newImage));

C#的另存后的图片是PNG格式的 对生成400*400的 所有的图片都会在100K左右 3M图片生成也是这么大 10K生成也是这么大.