By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,926 Members | 1,820 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,926 IT Pros & Developers. It's quick & easy.

Question about fetching a GIF image from assembly

P: n/a
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.


Jul 15 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a

"JimC" <ji**@nospam.plswrote in message
news:XB********************@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.


Jul 15 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.