Save Bitmap as PNG with transparency?

  • Thread starter Thread starter Bjorn Brox
  • Start date Start date
B

Bjorn Brox

Hi!

Windows Mobile 6.0, CF 3.5

I noticed that Bitmap.Save(xxx, ImageFormat.Png) (and Gif) does not
preserve transparency when inspecting the image in for example PhotoShop.

I even tried to run through each pixel before the save by executing
if (bmp.GetPixel(x, y) == Color.White)
bmp.SetPixel(x, y, Color.Transparent);
(debug showed that the SetPixel statement was executed)

Does anyone have some solution on how to save a bitmap as PNG (or gif)
where white is made total transparent?
 
Hi!

Windows Mobile 6.0, CF 3.5

I noticed that Bitmap.Save(xxx, ImageFormat.Png) (and Gif) does not
preserve transparency when inspecting the image in for example PhotoShop.

I even tried to run through each pixel before the save by executing
if (bmp.GetPixel(x, y) == Color.White)
bmp.SetPixel(x, y, Color.Transparent);
(debug showed that the SetPixel statement was executed)

Does anyone have some solution on how to save a bitmap as PNG (or gif)
where white is made total transparent?


Well instead try setting the white color as transparent in your code
and paint.

Ashish
 
Hi!

Windows Mobile 6.0, CF 3.5

I noticed that Bitmap.Save(xxx, ImageFormat.Png) (and Gif) does not
preserve transparency when inspecting the image in for example PhotoShop.

I even tried to run through each pixel before the save by executing
if (bmp.GetPixel(x, y) == Color.White)
bmp.SetPixel(x, y, Color.Transparent);
(debug showed that the SetPixel statement was executed)

Does anyone have some solution on how to save a bitmap as PNG (or gif)
where white is made total transparent?

Hi,
Instead mark the white color transparent while painting.

Ashish
 
(e-mail address removed) skrev:
Hi,
Instead mark the white color transparent while painting.

Ashish

The debugger shows that Color.Transparent is Color.White with alpha
channel set to zero.

An initial _graphics.Clear(Color.Transparent) did not help.
 
Back
Top