Knowledge Base

Snippets

28

Tested QualityLevel at 90 then 100; image quality results same, but with larger file size than QualityLevel 80. QualityLevel 90 reduced file size to 1.7Mb, and oddly QualityLevel 100 increased file size to 6.3Mb.

ImageCodecInfo[] codecs = ImageCodecInfo.GetImageEncoders(); 
ImageCodecInfo ici = null; 

foreach (ImageCodecInfo codec in codecs)
{ 
    if (codec.MimeType == "image/jpeg") 
    ici = codec; 
} 

EncoderParameters ep = new EncoderParameters(); 
ep.Param[0] = new EncoderParameter(System.Drawing.Imaging.Encoder.Quality, (long)100);

originalImage.Save(f.FullName.ToString(), ici, ep);

Post Rating

Comments

There are currently no comments, be the first to post one!

Post Comment

Only registered users may post comments.