Bug 30190 - PNG icons are not transparent
Summary: PNG icons are not transparent
Status: RESOLVED FIXED
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: mod_autoindex (show other bugs)
Version: 2.5-HEAD
Hardware: All other
: P3 normal with 5 votes (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-07-19 19:24 UTC by Sylvain Beucler
Modified: 2007-08-28 09:54 UTC (History)
0 users



Attachments
Transparent PNG icons (21.88 KB, application/x-gtar)
2004-12-10 20:57 UTC, Neale Pickett
Details
Transparent PNG icons (29.65 KB, application/x-gtar)
2004-12-10 21:07 UTC, Neale Pickett
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Sylvain Beucler 2004-07-19 19:24:06 UTC
I changed Savannah's mod_autoindex configuration to use PNGs /icons (no GIFs at
gnu.org), and noticed that the PNG files do not have a transparent background.
I used this quick script to convert them well from GIFs:

for i in *.png; do giftopnm --alphaout $i.msk ${i%png}gif
| pnmtopng -alpha $i.msk > $i; rm -f $i.msk; done

(the script iterates on png's because the animation gif should not be taken into
account).
Comment 1 Phil Pennock 2004-08-15 20:18:04 UTC
Now I have a bugzilla account I'm actually doing something about this.  This
bites me frequently, hence the vote.  If the pnm tools aren't installed, but
gif2png is, then:

$ gif2png -tw *.gif small/*.gif | xargs gif2png -ghnrsO

Expected output from command-line is one stderr message from the first gif2png
invocation, noting the animated GIF (which is the reason for doing things this way).
Comment 2 André Malo 2004-08-15 20:39:55 UTC
I see the problem, that there are just a few browsers that actually support
transparent png images, resp. some browsers have real problems with them.
Perhaps we should just put the conversion script snippets somewhere into the docs?
Comment 3 Phil Pennock 2004-08-15 21:15:48 UTC
The problem is that the PNGs are shipped at all without transparency.  Since the
PNGs aren't actually used by default, can't they be fixed so that anyone who
chooses to use them at least gets full PNGs which don't look so bad in
mod_autoindex that they put people off using PNGs?

It looks as though MSIE is the one fly in the ointment:
  http://www.libpng.org/pub/png/pngstatus.html
but according to that, cells which aren't completely opaque are rendered as
completely transparent; since the Apache images don't use blending but have
pixels either transparent or with colour (AFAIK), for this purpose is there
actually a problem?

I just checked with my fiancee's MSIE 6.0 and the few icons used in one of my
mod_autoindex pages rendered just fine; that's with the transparent PNGs
rendered by the example command-line which I gave.  In fact, I've just created a
web-page using all the PNG icons (except those in small) and they _all_ rendered
fine.

If anyone wants to test more widely, there seems to be a decent testbed at:
  http://entropymine.com/jason/testbed/pngtrans/
but that covers a much more general case than the Apache icons, which require a
much simpler subset of PNG rendering functionality.
Comment 4 Neale Pickett 2004-12-10 20:57:57 UTC
Created attachment 13727 [details]
Transparent PNG icons

Transparent PNG icons, converted from the transparent GIFs from the 2.0.52
source distribution.
Comment 5 Neale Pickett 2004-12-10 21:07:03 UTC
Created attachment 13728 [details]
Transparent PNG icons

New version with the small directory included
Comment 6 Neale Pickett 2004-12-10 21:10:55 UTC
Sorry for all the new comments, I'm unfamiliar with bugzilla.

I've attached a tarball of transparent PNG icons.  These were converted from the
GIFs distributed with 2.0.52 using "giftopng -O".  They are slightly (a few
bytes per icon) larger than the old, non-transparent ones, and as far as I can
tell display just fine in all browsers (even IE).

Please consider moving these icons into CVS so they may one day be distributed.
 I'm getting tired of having to convert the GIFs by hand every time I install a
new version of Apache :)

Thanks
Comment 7 Thijs Kinkhorst 2006-11-12 05:50:57 UTC
I can indeed still reproduce it. I hope it can be fixed; as said the icons now
display badly in *any* browser while that could be reduced to only some (by now
already older) browers.

The following snippet when using ImageMagick solves it:

for i in *.png; do convert ${i%png}gif $i;done

Thanks.
Comment 8 Neale Pickett 2007-08-27 12:17:55 UTC
Come on guys, it's been 3 years and we've provided you three different ways to 
fix this.
Comment 9 William A. Rowe Jr. 2007-08-28 04:00:32 UTC
Thanks for the ImageMagick pointer (although I had to resort to GraphicsMagick
since ImageMagick was generating corrupt .png's).

Note I used the -quality 100 to avoid any lossy optimization.
Comment 10 Neale Pickett 2007-08-28 09:54:58 UTC
(In reply to comment #9)

Thanks, Will!  You are my PNG hero.