Saving Bitmap as 32bpp doesn't keep transparency

前端 未结 1 710
醉梦人生
醉梦人生 2020-12-20 05:51
using (var bmp = new Bitmap(image.Width, image.Height, PixelFormat.Format32bppArgb))
using (var g = Graphics.FromImage(bmp))
{
    g.Clear(Color.Transparent);
    g.         


        
相关标签:
1条回答
  • 2020-12-20 06:37

    It's because by default the bmp file format doesn't support transparency while the png file format does.

    If you want transparency you are going to have to use png. The compression algorithms are lossless so you're not going to get artefacts in your image. The file will take up less space on disk too.

    0 讨论(0)
提交回复
热议问题