Page MenuHomePhabricator

Black color is always taken as transparent when downsampling GIF images using GD
Closed, DeclinedPublic

Description

Although code comments tell us "Initialise the destination image to transparent _instead_ of the default solid black, to support PNG and GIF transparency nicely", the black color is always taken as transparent when downsampling GIF images.
See the patch attached.


Version: 1.17.x
Severity: enhancement

Details

Reference
bz24855

Event Timeline

bzimport raised the priority of this task from to Low.Nov 21 2014, 11:01 PM
bzimport set Reference to bz24855.
bzimport added a subscriber: Unknown Object (MLST).

includes/media/Bitmap.php.diff

attachment Bitmap.php.diff ignored as obsolete

Fenyx4 wrote:

I was able to workaround this by changing $wgUseImageMagick to true in LocalSettings.
And then I just wiped out the images/thumbs directory and it redid all the gifs correctly.

*Bulk BZ Change: +Patch to open bugs with patches attached that are missing the keyword*

Still actual for svn89562. Any progress?

(In reply to comment #2)

I was able to workaround this by changing $wgUseImageMagick to true in
LocalSettings.
And then I just wiped out the images/thumbs directory and it redid all the gifs
correctly.

That's not very good to use external converter when there's standard PHP GD available.

Always resample setting + correct imagecolorallocatealpha

Additional comment: I think MW should have a setting for always downsampling paletted images with "imagecopyresampled" instead of "imagecopyresized" as the latter preserves transparency, but makes images ugly because of NearestNeighbor interpolation.

Attached:

sumanah wrote:

Comment on attachment 7636
includes/media/Bitmap.php.diff

Obsoleted by Vitaliy's next patch.

sumanah wrote:

Vitaliy, I am so sorry for the wait for a response. To get this reviewed faster, I'd love to get it moved into Gerrit, our code review system. https://www.mediawiki.org/wiki/Git/Tutorial gives you instructions on how to do that. If this issue is still reproducible, could you submit it that way?

Thank you for the patch.

Vitaliy, could you please address the concerns posted by Brian Wolff on that Gerrit changeset?

$wgGDAlwaysResample needs entry in DefaultSettings.php.
Also should justify why a global is needed (what circumstances would you want the behaviour overriden)

(In reply to comment #8)

Moved in Gerrit change #22945

Abandoned.

Anyone knows if this is still a problem? If it is, can you please provide clear steps to reproduce the problem and include MW and GD versions?

https://gerrit.wikimedia.org/r/#/c/mediawiki/core/+/22945/ for the records.

Aklapper changed the task status from Open to Stalled.Mar 24 2019, 4:19 PM

Anyone knows if this is still a problem? If it is, can you please provide clear steps to reproduce the problem and include MW and GD versions?

Setting task status to stalled until someone replies.

Unfortunately closing this Phabricator task as no further information has been provided.

After you have provided the information asked for and if this still happens, please set the status of this task back to "Open" via the Add Action...Change Status dropdown. Thanks!