Question about saving bitmap in .NET.

I have a raster object and draw some curves on it using the setpixel method. when I save this bitmap as a jpg file, the background of my image is not a white surface. background is transparent. what is the problem? How can I solve this problem?

+3
source share
2 answers

Call Graphics.Clear(Color.White)before drawing a bitmap. If you don't already have an instance System.Drawing.Graphicsfor your bitmap, here's how to get it:

Graphics g = Graphics.FromImage(bitmap);

Clear bitmap:

g.Clear(Color.White);

And of course, don't forget to call Dispose()when you 're done with the graphics.

g.Dispose();
+6
source

, JPEG? AFAIK, JPEG , , , GIF PNG ".jpg", .

Zach .

0

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


All Articles