Image compression in .NET.

How can I compress and image file (* bmp, * jpeg) in C #, I have to display some images as a background on my controls, I use the following code to scale the image

Bitmap orgBitmap = new Bitmap(_filePath);
Bitmap regBitmap = new Bitmap(reqSize.Width, reqSize.Height);

 using (Graphics gr = Graphics.FromImage(reqBitmap))
 {
  gr.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
  gr.DrawImage(bmp, new RectangleF(0, 0, reqSize.Width, reqSize.Height));
  }

This gives me the necessary bitmap. My problem is that if the original bitmap is heavy (2 MB), then when I load 50 images, it loads all my memory, I want to compress the image as much as I can, without losing as much quality. How can I do the same. NET?

+3
source share
4 answers

, ? ( ) (Photoshop, Paintshop Pro ..) ? , , , , , , , .

, , .

: , ? ... () , , . .

+3

, , jpg, ?

+1

JPEG.:) . BMP, JPEG.

0

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


All Articles