Jpg images directly generated in the program, with Chinese characters with edges. After some searches, I found the following article on msdn that controls the jpg quality coefficient. I tried it after modification, the effect is indeed much better than the previous one. I don't know much about the principle. I posted the code and shared it with you.
The compression in the joint image Expert Group (JPEG) file is controlled by a group of quantization tables. Generally, there are two tables in each file: one for brightness information and the other for chrominance information. These tables are the 8x8 matrix with the Discrete Cosine values of 8x8 quantized.
JPEG quality coefficient is used to generate a pair of quantization tables. Many applications generate the same quantization table based on the independent JPEG group (IJG) Code and reference the code for IJG. However, some applications may use the custom quantization table.
The encoder parameter settings provided in the JPEG encoder System. Drawing Save the JPEG file. This encoder parameter complies with the range 1 to 100 using an integer convention. The value of this encoder parameter affects the creation and use of the quantization table and the recommended quality coefficient.
The Code is as follows:
System. Drawing. Image newimage = System. Drawing. Image. FromFile ("c: \ 00.jpg ");
Bitmap bt = new Bitmap (newimage );
Graphics g = Graphics. FromImage (bt );
(Code for drawing on the canvas is omitted in the middle)
String lujing = @ "c: 1.jpg ";
// Processing JPG Quality Functions
Int level = 100; // The range of image quality from 1
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) level );
Bt. Save (lujing, ici, ep );
// Release the bitmap cache
Bt. Dispose ();