[Mediawiki-l] Mediawiki: Transparency of uploaded PNG images

Rowan Collins rowan.collins at gmail.com
Tue Jun 6 12:56:01 UTC 2006


On 06/06/06, Martin Ceronio - BIS <martin.ceronio at za.sabmiller.com> wrote:
> Hello Morten and Rowan,

Firstly, it's probably best to folow up conversations you see in
mailing list archives to the mailing list, rather than picking out the
e-mail addresses of participants, who may no longer be involved in the
topic, or may not even check that address any more. Also, of course,
this reply wouldn't show up in any archives for people to search out
in the future (it will now, because I've added the list to the CC
field). Just a tip for the future.

> I found the same problem with PNG images as described at
> http://mail.wikipedia.org/pipermail/mediawiki-l/2005-August/006421.html.
>
> However, I'm pretty sure it's not an IE problem, since the image I use for
> my site's logo is also PNG, and it handles the transparency without problems
> (when viewed in IE).

Looking at that conversation, I'm pretty sure that at least that
problem *was* an IE issue, and I suspect yours may be too - the fact
that your logo is a PNG doesn't prove anything, the crucial question
is whether *the image you've been having problems with*, without
uploading it anywhere, displays correctly in IE.

The key thing you need to know is that there are 2 types of
transparency that can be used in PNGs - simple 'palette' transparency,
and 'alpha' transparency. One simply defines one of the colours in the
file as 'transparent', and is also how transparency works in GIFs; the
other allows every pixel in the image to have a *degree* of
transparency, allowing the image to blend nicely into whatever
background you happen to place it on.

The problem is, Internet Explorer doesn't know how to display 'alpha'
transparency properly, and creates an ugly grey background to the
image instead. PNG images with only 'palette' transparency will work
fine, just as GIF images would - but you have to have saved the file
with the right (or, as it were, wrong) options.

> Also, I have removed the |##px| parameter from my
> [[Image]] tag, and it still gives the same problem.

I think you've got this the wrong way round - what seemed to be
happening in the conversation you linked to was that the code for
resizing images was (either by accident or design) converting 'alpha'
transparency into 'palette' transparency when resizing PNGs. The
result being that the resized image didn't look as good in browsers
that support alpha transparency properly, but became transparent in
IE. Whether this still happens, I've no idea.

> I am wondering if this has something to do with the way it is processed
> during uploading.

As far as I know, no processing of the image is done during uploading;
in various circumstances, the image will be resized *during display*,
which may have side-effects, but viewing the original image, at
original size, should behave exactly the same after you've uploaded it
as before.

All that said, I could, of course, be completely wrong.
But if so, I'm not the person to ask, as I have other things to do right now. :P

Happy wikification!
-- 
Rowan Collins BSc
[IMSoP]



More information about the MediaWiki-l mailing list