Black color is always taken as transparent when downsampling GIF images using GD
Open, LowPublic

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

Blocks
T18456: GIF Issues (tracking)
Reference
bz24855
bzimport added a subscriber: Unknown Object (MLST).
bzimport set Reference to bz24855.

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

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.

Moved in Gerrit change 22945

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.

Jdforrester-WMF moved this task from Untriaged to Backlog on the Multimedia board.Sep 4 2015, 6:08 PM
Restricted Application added subscribers: Steinsplitter, Matanya, Aklapper. · View Herald TranscriptSep 4 2015, 6:08 PM

Add Comment