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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top