all groups > dotnet drawing api > september 2005 >
You're in the

dotnet drawing api

group:

Alpha Channel not preserved when saving png


Alpha Channel not preserved when saving png Seth Juarez
9/30/2005 5:03:19 PM
dotnet drawing api: I have the following code that for some reason saves an image but greyed =
out.

EncoderParameters encoderParams =3D new EncoderParameters(1);
encoderParams.Param[0] =3D new EncoderParameter(Encoder.ColorDepth, =
32L);
this.CanvasImage.Save(filename, getEncoderInfo("image/png"), =
encoderParams);

Why does gdi have trouble preserving the transparency channel?

Re: Alpha Channel not preserved when saving png Michael Phillips, Jr.
9/30/2005 7:42:52 PM
Encoder.ColorDepth is not supported for the png encoder.

You must use:

this.CanvasImage.Save(filename, ImageFormat.png);
[quoted text, click to view]
I have the following code that for some reason saves an image but =
greyed out.

EncoderParameters encoderParams =3D new EncoderParameters(1);
encoderParams.Param[0] =3D new EncoderParameter(Encoder.ColorDepth, =
32L);
this.CanvasImage.Save(filename, getEncoderInfo("image/png"), =
encoderParams);

Why does gdi have trouble preserving the transparency channel?

Re: Alpha Channel not preserved when saving png Seth Juarez
9/30/2005 8:32:09 PM
I tried that; i thought i needed to be fancier so i tried to do it the =
way i showed you. You can still see the image after it is saved, but it =
seems like the alpha channel is not being saved because the image is =
greyed out!


Seth
[quoted text, click to view]
Encoder.ColorDepth is not supported for the png encoder.

You must use:

this.CanvasImage.Save(filename, ImageFormat.png);
[quoted text, click to view]
I have the following code that for some reason saves an image but =
greyed out.

EncoderParameters encoderParams =3D new EncoderParameters(1);
encoderParams.Param[0] =3D new EncoderParameter(Encoder.ColorDepth, =
32L);
this.CanvasImage.Save(filename, getEncoderInfo("image/png"), =
encoderParams);

Why does gdi have trouble preserving the transparency channel?

AddThis Social Bookmark Button