I use reflection to get a GIF image that contains a transparency
mask (the white background should be transparent) that is
part of my C# project build. The problem is that the image's
transparency property disappears when I render it making
it look as if were a JPEG image.

The code I use is:

Assembly assem = this.GetType().Assembly;
Stream streamTransPic =
assem.GetManifestResourceStream("MyProject.images.transPic.gif");
transPic = System.Drawing.Image.FromStream(streamTransPic);

It is rendered with Graphics.DrawImage method in

gObj.DrawImage (transPic, rect);

where gObj is an instance of Graphics and rect has already been
defined.

If I read the image from a file rather than storing it in the compiled
assembly, its GIF transparency property is present when I render
it. But I don't want to use separate data files with production code.

Re: Question about fetching a GIF image from assembly by JimC

JimC
Sat Jul 15 14:45:48 CDT 2006


"JimC" <jimc@nospam.pls> wrote in message
news:XB6ug.121571$H71.10760@newssvr13.news.prodigy.com...
>I use reflection to get a GIF image that contains a transparency
> mask (the white background should be transparent) that is
> part of my C# project build. The problem is that the image's
> transparency property disappears when I render it making
> it look as if were a JPEG image.
>
> The code I use is:
>
> Assembly assem = this.GetType().Assembly;
> Stream streamTransPic =
> assem.GetManifestResourceStream("MyProject.images.transPic.gif");
> transPic = System.Drawing.Image.FromStream(streamTransPic);
>
> It is rendered with Graphics.DrawImage method in
>
> gObj.DrawImage (transPic, rect);
>
> where gObj is an instance of Graphics and rect has already been
> defined.
>
> If I read the image from a file rather than storing it in the compiled
> assembly, its GIF transparency property is present when I render
> it. But I don't want to use separate data files with production code.

Sorry. Let's cancel this question. I discovered that I had stored a
GIF image which didn't have the transparency mask present. When I
replaced it and recompiled, everything worked the way it should
for a GIF image.