我只是在加载 JPEG 图像并保存它,而无需对其进行任何操作。但图像质量明显下降。
这是代码:
Bitmap imgOutput = new Bitmap(@"D:\image.jpg");
Graphics outputGraphics = Graphics.FromImage(imgOutput);
EncoderParameters myEncoderParameters = new EncoderParameters(3);
myEncoderParameters.Param[0] = new EncoderParameter(System.Drawing.Imaging.Encoder.Quality, 100L);
myEncoderParameters.Param[1] = new EncoderParameter(System.Drawing.Imaging.Encoder.ScanMethod, (int)EncoderValue.ScanMethodInterlaced);
myEncoderParameters.Param[2] = new EncoderParameter(System.Drawing.Imaging.Encoder.RenderMethod, (int)EncoderValue.RenderProgressive);
ImageCodecInfo[] codecs = ImageCodecInfo.GetImageEncoders();
ImageCodecInfo ici = null;
foreach (ImageCodecInfo codec in codecs)
{
if (codec.MimeType == "image/jpeg")
ici = codec;
}
imgOutput.Save(@"D:\result.jpg", ici, myEncoderParameters);
我得到了什么:http: //i.imgur.com/5bG1tPM.jpg放大:http: //i.imgur.com/vdx8sL5.jpg
是否有其他图像质量设置?