471,319 Members | 1,698 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,319 software developers and data experts.

Making a transparent gif can't REALLY be this hard, can it?

RCS
I'm working on an ASP.NET webpage that generates an image (and am using VWD
2005 until my copy of VS2005 ships). I have done all the obvious (and
not-so-obvious) things to try to give a gif that I am generating, a
transparent background.

On the newsgroups - everyone points to this MSDN article: How to save a .gif
file with a new color table by using Visual C# .NET
http://support.microsoft.com/default...b;en-us;319061

Even though, it seems like this might be overkill - I can't compile it,
because it has an unsafe codeblock and I don't believe I can compile with
the /unsafe option with an Express product (does anyone know any
different??).

Has something been done since the early 2000's to make saving a gif with a
transparent background easier? Most articles I found were from 2001 and
2002, which makes me think this is no longer an issue?

Oh - and if I make a PNG with a transparent background, that works
perfectly, but IE does not acknowledge PNGs with transparent backgrounds and
shows grey instead. So I seem stuck between a rock and a hard place on
something I didn't expect to spend this much time on!

It's the year 2005 - surely there is some simple answer?!? Any ideas! thanks
Nov 28 '05 #1
9 4917
IE can show alpha transparency with a very little trick.
See this for example:

http://cam70.sta.uniroma1.it/Technic...ansparency.htm

The necessary to do the trick you can get directly from that web demo
page and the site via http.
Or else, downloading the program, inside there is a mall file
"Transparency.zip" which has all in it.
All other browser have no problems.
In any case, these tricks are all well-know things you can easily find
about googling on the web.

Greetings

Tommaso
http://cam70.sta.uniroma1.it/TechnicalPreview/

Nov 28 '05 #2
See the GDI+ FAQ article on transparent gifs.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.

"RCS" <rs****@gmail.com> wrote in message
news:IK*****************@newssvr33.news.prodigy.co m...
I'm working on an ASP.NET webpage that generates an image (and am using
VWD 2005 until my copy of VS2005 ships). I have done all the obvious (and
not-so-obvious) things to try to give a gif that I am generating, a
transparent background.

On the newsgroups - everyone points to this MSDN article: How to save a
.gif file with a new color table by using Visual C# .NET
http://support.microsoft.com/default...b;en-us;319061

Even though, it seems like this might be overkill - I can't compile it,
because it has an unsafe codeblock and I don't believe I can compile with
the /unsafe option with an Express product (does anyone know any
different??).

Has something been done since the early 2000's to make saving a gif with a
transparent background easier? Most articles I found were from 2001 and
2002, which makes me think this is no longer an issue?

Oh - and if I make a PNG with a transparent background, that works
perfectly, but IE does not acknowledge PNGs with transparent backgrounds
and shows grey instead. So I seem stuck between a rock and a hard place on
something I didn't expect to spend this much time on!

It's the year 2005 - surely there is some simple answer?!? Any ideas!
thanks

Nov 29 '05 #3
RCS
Tommaso,

I did try that .htc and tried implementing it in pieces too - no matter what
I try, pngs still show with a grey background in IE!

Any other ideas?

<to**************@uniroma1.it> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
IE can show alpha transparency with a very little trick.
See this for example:

http://cam70.sta.uniroma1.it/Technic...ansparency.htm

The necessary to do the trick you can get directly from that web demo
page and the site via http.
Or else, downloading the program, inside there is a mall file
"Transparency.zip" which has all in it.
All other browser have no problems.
In any case, these tricks are all well-know things you can easily find
about googling on the web.

Greetings

Tommaso
http://cam70.sta.uniroma1.it/TechnicalPreview/

Nov 29 '05 #4
RCS
Bob,

Thanks for your input. The FAQ you referenced, well - that you talked about,
is what my original post was based on. After having read my original
message, do you have any other ideas? Or is your answer simply "yes,
transparent gifs -are- that hard"?

Thanks very much!

"Bob Powell [MVP]" <bob@_spamkiller_bobpowell.net> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
See the GDI+ FAQ article on transparent gifs.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.

"RCS" <rs****@gmail.com> wrote in message
news:IK*****************@newssvr33.news.prodigy.co m...
I'm working on an ASP.NET webpage that generates an image (and am using
VWD 2005 until my copy of VS2005 ships). I have done all the obvious (and
not-so-obvious) things to try to give a gif that I am generating, a
transparent background.

On the newsgroups - everyone points to this MSDN article: How to save a
.gif file with a new color table by using Visual C# .NET
http://support.microsoft.com/default...b;en-us;319061

Even though, it seems like this might be overkill - I can't compile it,
because it has an unsafe codeblock and I don't believe I can compile with
the /unsafe option with an Express product (does anyone know any
different??).

Has something been done since the early 2000's to make saving a gif with
a transparent background easier? Most articles I found were from 2001 and
2002, which makes me think this is no longer an issue?

Oh - and if I make a PNG with a transparent background, that works
perfectly, but IE does not acknowledge PNGs with transparent backgrounds
and shows grey instead. So I seem stuck between a rock and a hard place
on something I didn't expect to spend this much time on!

It's the year 2005 - surely there is some simple answer?!? Any ideas!
thanks


Nov 29 '05 #5
That is a proven method, also recommended by the ie microsoft team.
There are absolutely no doubts it works (the demo is proof).

** Note that if the page is open on the *local* machine
IE may *block* the script for security reason. Check if there is a
message near the command bar
and in case you must allow script execution to see transparency. **

Other hints:
Check also you are actually executing the script (locally you should
get an alarm).
Check that the images are really transparent.

People visiting the page from remote will have no problem.

tommaso

PS
I suggest to forget about gif. Indexed formats are complicate with gdi
and actually png is much better and flexible...
IE7 will support alpha transp

Nov 30 '05 #6
Ah, and another very crucial thing:

check that * blank.gif * is in the current directory and make
sure to use the one provided (do not temper with it).

Without blank.gif it will not work, of course.

Let me know...

tg

Nov 30 '05 #7
RCS
Tommaso,

I did finally get this working, thanks very much! And yeah, it seems like
..png is the way to go, for several reasons - but until IE fully supports it,
it's still a pain. It seems once IE7 comes out, png will completely replace
..gif

Thanks again very much!

<to**************@uniroma1.it> wrote in message
news:11*********************@g14g2000cwa.googlegro ups.com...
That is a proven method, also recommended by the ie microsoft team.
There are absolutely no doubts it works (the demo is proof).

** Note that if the page is open on the *local* machine
IE may *block* the script for security reason. Check if there is a
message near the command bar
and in case you must allow script execution to see transparency. **

Other hints:
Check also you are actually executing the script (locally you should
get an alarm).
Check that the images are really transparent.

People visiting the page from remote will have no problem.

tommaso

PS
I suggest to forget about gif. Indexed formats are complicate with gdi
and actually png is much better and flexible...
IE7 will support alpha transp

Nov 30 '05 #8
I am very happy to hear that.

greetings

tommaso

Nov 30 '05 #9
Ah, I see. Well, yes then, they are that hard...

Bob.

"RCS" <rs****@gmail.com> wrote in message
news:%Z****************@newssvr30.news.prodigy.com ...
Bob,

Thanks for your input. The FAQ you referenced, well - that you talked
about, is what my original post was based on. After having read my
original message, do you have any other ideas? Or is your answer simply
"yes, transparent gifs -are- that hard"?

Thanks very much!

"Bob Powell [MVP]" <bob@_spamkiller_bobpowell.net> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
See the GDI+ FAQ article on transparent gifs.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.

"RCS" <rs****@gmail.com> wrote in message
news:IK*****************@newssvr33.news.prodigy.co m...
I'm working on an ASP.NET webpage that generates an image (and am using
VWD 2005 until my copy of VS2005 ships). I have done all the obvious
(and not-so-obvious) things to try to give a gif that I am generating, a
transparent background.

On the newsgroups - everyone points to this MSDN article: How to save a
.gif file with a new color table by using Visual C# .NET
http://support.microsoft.com/default...b;en-us;319061

Even though, it seems like this might be overkill - I can't compile it,
because it has an unsafe codeblock and I don't believe I can compile
with the /unsafe option with an Express product (does anyone know any
different??).

Has something been done since the early 2000's to make saving a gif with
a transparent background easier? Most articles I found were from 2001
and 2002, which makes me think this is no longer an issue?

Oh - and if I make a PNG with a transparent background, that works
perfectly, but IE does not acknowledge PNGs with transparent backgrounds
and shows grey instead. So I seem stuck between a rock and a hard place
on something I didn't expect to spend this much time on!

It's the year 2005 - surely there is some simple answer?!? Any ideas!
thanks



Nov 30 '05 #10

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Efkas | last post: by
8 posts views Thread by Grahammer | last post: by
4 posts views Thread by jcrouse | last post: by
5 posts views Thread by Tony Clark | last post: by
11 posts views Thread by Marge | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.