Jpgimages are directly produced in the program. The quality is inferior to that of the source Image because of Microsoft Image. the Save method is saved to the image compression quality of 75, so the quality of the saved image is low, to improve the quality of the generated image, you must set the quality parameters of the EncoderParameters class and the image storage format of the ImageCodecInfo class.
System. drawing. imaging. the Encoder class is used to specify the mode and parameters to be presented, such as slice quality parameters, scan method parameters, color table parameters, compression parameters, and color depth. at this point, you should understand the steps and methods for modifying the image quality. mainly for System. drawing. imaging. encoder settings, and then use System. drawing. imaging. encoder constructs the EncoderParameter class and passes the EncoderParameter to the EncoderParameters array to get an image that fits your needs! The code is actually very simple:
First introduce: using System. Drawing. Imaging;
SaveImageForSpecifiedQuality (System. drawing. image sourceImage, savePath, EncoderParameters encoderParameters =] === (I =; I <ImageCodecInfoArray. length; I ++ (ImageCodecInfoArray [I]. formatDescription. equals (= View Code
Call method:
System. Drawing. Image image = System. Drawing. Image. FromFile (, ImageFormat. Jpeg );
Image. Dispose ();