位图编码器质量不起作用

时间:2014-07-17 12:25:09

标签: winforms bitmap encoder

我的代码出了什么问题原始的197 Kb位图我想减少质量(很少可以)但是当使用上面的代码时,尺寸大于原始大小,如247Kb为什么? - 出了什么问题

 //I added already Drawing.dll in Referance for using drawing class in WPF
//Bitmap size 197Kb without any encode
ImageCodecInfo ci = GetEncoer(ImageFormat.Png);
System.Drawing.Imaging.Encoder enc;
EncoderParameter ep;
EncoderParameters eps;

enc = System.Drawing.Imaging.Encoder.Quality;
ep = new EncoderParameter(enc,1L);
eps = new EncoderParameters(1);
eps.Param[0] = ep;
MemoryStream ms = new MemoryStream();
bitmap.Save(ms, ci, eps);
Image img = Image.FromStream(ms);
Bitmap bmp = new Bitmap(img);
return bmp;
//After aplly this function size 257Kb

0 个答案:

没有答案