Black color is always taken as transparent when downsampling GIF images using GD
OpenPublic

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

bzimport added a subscriber: Unknown Object (MLST).
bzimport set Reference to bz24855.
VitaliyFilippov created this task.Via LegacyAug 18 2010, 3:52 PM
VitaliyFilippov added a comment.Via ConduitAug 18 2010, 3:53 PM

includes/media/Bitmap.php.diff

attachment Bitmap.php.diff ignored as obsolete

bzimport added a comment.Via ConduitOct 26 2010, 7:50 PM

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.

Peachey88 added a comment.Via ConduitApr 30 2011, 12:10 AM

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

VitaliyFilippov added a comment.Via ConduitJun 6 2011, 2:21 PM

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.

VitaliyFilippov added a comment.Via ConduitJun 6 2011, 2:26 PM

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: Always-Resample-svn89562.diff

bzimport added a comment.Via ConduitJan 11 2012, 9:26 PM

sumanah wrote:

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

Obsoleted by Vitaliy's next patch.

bzimport added a comment.Via ConduitSep 6 2012, 7:18 PM

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.

Krenair added a comment.Via ConduitSep 6 2012, 7:23 PM

Moved in Gerrit change 22945

Krenair added a comment.Via ConduitSep 13 2012, 9:57 PM

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)

Krenair added a comment.Via ConduitNov 25 2012, 2:15 AM

(In reply to comment #8)

Moved in Gerrit change #22945

Abandoned.

Gilles added a project: Multimedia.Via WebNov 24 2014, 3:37 PM

Add Comment