Poor screen image

I want to have a low quality image on the screen. I can make a bitmap, but no matter what I do, I cannot lower its quality.

+6
source share
2 answers
Image bmp1 = GetScreenImage (); // Save the image as a GIF. bmp1.Save("c:\\button.gif", System.Drawing.Imaging.ImageFormat.Gif); 

Msdn for more .

+3
source

I would try to convert the image to compressed jpeg. The good thing about jpegs is that you can set how high quality it should be (that is, how much you want it to be compressed):

Note: The quality should be from 1 to 100 (100 is the largest size / highest quality, and 1 is the smallest size / lowest quality.

 public void save(string filename, Bitmap img, int quality) { // quality encoding EncoderParameter qualParam = new EncoderParameter(Encoder.Quality, quality); // code for jpeg image type ImageCodecInfo jpegCodec = FindEncoderInfo("image/jpeg"); EncoderParameters encoderParams = new EncoderParameters(1); encoderParams.Param[0] = qualParam; img.Save(filename, jpegCodec, encoderParams); } private ImageCodecInfo FindEncoderInfo(string mimeType) { // search through all codecs for all formats ImageCodecInfo[] codecs = ImageCodecInfo.GetImageEncoders(); for (int i = 0; i < codecs.Length; i++) { if (codecs[i].MimeType == mimeType) { return codecs[i]; } } return null; } 
+3
source

Source: https://habr.com/ru/post/890798/


All Articles