Last modified: 2012-02-22 12:35:17 UTC

Wikimedia Bugzilla is closed!

Wikimedia has migrated from Bugzilla to Phabricator. Bug reports should be created and updated in Wikimedia Phabricator instead. Please create an account in Phabricator and add your Bugzilla email address to it.
Wikimedia Bugzilla is read-only. If you try to edit or create any bug report in Bugzilla you will be shown an intentional error message.
In order to access the Phabricator task corresponding to a Bugzilla report, just remove "static-" from its URL.
You could still run searches in Bugzilla or access your list of votes but bug reports will obviously not be up-to-date in Bugzilla.
Bug 234 - PNG thumbnails change binary transparency to alpha transparency, causing IE6 problems
PNG thumbnails change binary transparency to alpha transparency, causing IE6 ...
Product: MediaWiki
Classification: Unclassified
File management (Other open bugs)
All Windows XP
: Low minor with 3 votes (vote)
: ---
Assigned To: Nobody - You can work on this!
: patch
: 12405 (view as bug list)
Depends on:
Blocks: 640
  Show dependency treegraph
Reported: 2004-08-27 17:21 UTC by Eric Pierce
Modified: 2012-02-22 12:35 UTC (History)
7 users (show)

See Also:
Web browser: Internet Explorer
Mobile Platform: ---
Assignee Huggle Beta Tester: ---

Patch against 1.19 version of includes/Image.php to fix a thumbnailing bug (1.58 KB, patch)
2004-08-27 17:24 UTC, Eric Pierce
Cleaned up version of patch (1.38 KB, patch)
2004-08-28 02:24 UTC, Brion Vibber
Broken output in IE (50.40 KB, image/png)
2004-08-28 02:34 UTC, Brion Vibber
Output in IE without the patch [in GD scaling mode] (62.86 KB, image/png)
2004-08-28 04:39 UTC, Brion Vibber
Output in IE using ImageMagick mode (72.58 KB, image/png)
2004-08-28 04:56 UTC, Brion Vibber

Description Eric Pierce 2004-08-27 17:21:04 UTC
Thumbnails of PNG images have two related problems:

* Indexed-color images are converted to true-color thumbnails, resulting in
excessive file size. Indexed-color PNGs should be converted to indexed-color
* As a result of the above, transparency in PNG thumbnails is of the variety
that causes Internet Explorer to have problems; transparency should, for now,
always be implemented in a way that will work with this browser.
Comment 1 Eric Pierce 2004-08-27 17:24:04 UTC
Created attachment 15 [details]
Patch against 1.19 version of includes/Image.php to fix a thumbnailing bug
Comment 2 Brion Vibber 2004-08-28 02:24:55 UTC
Created attachment 16 [details]
Cleaned up version of patch

Took out the probably accidental reversion of the last changes to Image.php;
fixed spacing.
Comment 3 Brion Vibber 2004-08-28 02:34:12 UTC
Created attachment 17 [details]
Broken output in IE

Well, something doesn't seem to be working correctly. Here's a screen shot
(from IE6) of two images I uploaded to my test wiki -- an alpha transparency
test image [the white area should be transparent] and the english wikipedia
logo [indexed PNG with binary transparency].

First, both were turned into indexed images; the alpha test image should have
remained truecolor I think. Second, there's something _really_ weird wrong with
them. They seem to be using alpha transparency, not binary. They show ok in
Safari, but in IE6/Windows they are displayed horribly corrupt. Also, some of
the bright white spots in the wikipedia logo end up going towards transparent
instead of solid white (as visible in Safari or loaded in Gimp).

Tested with PHP 4.3.8, Mac OS X 10.3.5. Using PHP's built in libgd plus png and
jpeg libraries and ImageMagick from fink. (ImageMagick 5.5.6.

A couple other issues: this patch as is will break if ImageMagick is not
available, so it needs some tweaking to work without. Also it uses the
imagesavealpha() function which is only available from PHP 4.3.2; we're trying
to support back to 4.1.2 (what Debian ships), so check for an alternate way of
doing this.
Comment 4 Brion Vibber 2004-08-28 04:39:24 UTC
Created attachment 18 [details]
Output in IE without the patch [in GD scaling mode]

It seems that there may be some (possibly big-endian-specific) bugs in the
latest libpng package, so I tried on another machine. Linux/x86 (Fedora Core
2), PHP 5.0.1 with built-in GD. System's libpng is 1.2.5-3. The output is still
wrong: the indexed image thumb is not transparent at all, it's on a solid
background. The alpha blending test image has seemingly lost all but the red
channel, and large portions of it are mysteriously transparent in IE6/Windows
(but solid in Safari and IE 5.2/mac!)

Argggh... tylenol...
Comment 5 Brion Vibber 2004-08-28 04:43:51 UTC
Wow, I really do need that tylenol. ;) That last picture is with the *unpatched current code* with scaling in GD 

Unfortunately, patched it produces the exact same output as it does on my Mac. Broken either way. :(
Comment 6 Brion Vibber 2004-08-28 04:56:28 UTC
Created attachment 19 [details]
Output in IE using ImageMagick mode

Just for comparison, here's the same images rendered with current ImageMagick
scaling. IE displays the thumbs with solid white backgrounds.
Comment 7 Eric Pierce 2004-08-29 20:13:05 UTC
My local wiki installation seems to have broken, so I can't test this right now,
but I just discovered that ImageMagick apparently has a depth-reduction option:

convert -type Palette (source) (dest)

Would it work to simply use this command, and drop all the GD stuff? i.e.:

if truecolor
(use the ImageMagick command we have now)
(same command, but with the -type Palette option)

Meanwhile, I'll figure out what's wrong with my wiki and test it out...
Comment 8 Eric Pierce 2004-08-29 20:55:04 UTC
I got my local install fixed and tried this out. Seems to work OK, except there
are some odd dithering artifacts in some images; as far as I can tell,
transparency is binary (as it should be), but I don't have MSIE available to see
how well it handles them.

One option that reduces some of the speckling artifacts is "-colorspace
Transparent", which must be specified together with "-colors 255" (256 might
work but I'm assuming one index is used for transparency). Others that might
have an effect, but made no difference in my test images:

-treedepth X (where X is something other than 0 or 1)
-quality X
Comment 9 Zigger 2005-07-10 14:04:06 UTC
MSDN blog entries regarding IE and PNG alpha-transparency:
Comment 10 Philippe Verdy 2006-02-01 12:47:06 UTC
Note: IE7 now supports alpha transparency in PNG images.
Comment 11 Aryeh Gregor (not reading bugmail, please e-mail directly) 2008-07-29 21:03:21 UTC
*** Bug 1218 has been marked as a duplicate of this bug. ***
Comment 12 Aryeh Gregor (not reading bugmail, please e-mail directly) 2008-07-29 21:13:27 UTC
Repurposing to the transparency issue only, leaving bug 1218 for the size increase.
Comment 13 Siebrand Mazeland 2009-06-04 11:00:13 UTC
Update OS/Web browser.
Comment 14 Siebrand Mazeland 2009-06-04 11:35:31 UTC
Adding testme. Please test with Internet Explorer 8 and note the result here.
Comment 15 Aryeh Gregor (not reading bugmail, please e-mail directly) 2009-06-04 17:21:19 UTC
The problem is not going to occur in Internet Explorer >= 7, since that supports alpha transparency in PNGs:

As long as IE6 still has significant market share, however, we can't just ignore it and tell users to upgrade.  (Many of them are using it in locked-down corporate settings where they can't upgrade, or use another browser.)
Comment 16 Guillaume Paumier 2009-12-31 00:51:17 UTC
*** Bug 12405 has been marked as a duplicate of this bug. ***
Comment 17 DieBuche 2011-07-07 16:02:53 UTC
This has been around since 2004 and realistically, with IE6 at 3.5%, I don't see anyone starting to work on it now.

Note You need to log in before you can comment on or make changes to this bug.