Page MenuHomePhabricator

"ImageMagick" SVG converter shouldn't use "-background white", but "transparent"
Closed, ResolvedPublic

Description

"ImageMagick" SVG converter shouldn't use "-background white", but "transparent". No idea why this is done this way, changing it didn't break anything for me, but I assume there's a reason. Right now we can't rasterize SVGs for T76473 without losing transparency…

Event Timeline

matmarex raised the priority of this task from to Needs Triage.
matmarex updated the task description. (Show Details)
matmarex changed Security from none to None.
matmarex added subscribers: Bawolff, aaron.
Gilles moved this task from Untriaged to Prototyping on the Multimedia board.
Gilles added a subscriber: Gilles.

Possible guess (without looking at code): work around ie6 png transparency bug. -background controls both the rendering background and the png fallback if alpha not supported background.

If that is the case, i believe its possible to specify both independently using the switch multiple times.

Can you do that, please? Or anyone? Please? :)

I did some research and experimenting. Brian's guess seems correct and his proposed solution seems to work.

I took this SVG file:

(source: https://commons.wikimedia.org/wiki/File:WikiFont_signature_icon.svg), uploaded to a testing wiki and rasterized with the following options in $wgSVGConverters['ImageMagick']:

  • -background white: F37591 – result: opaque white background
  • -background transparent: F37593 – result: transparent background, renders as solid black square using IE6 on WinXP
  • -background "#ffffff00": F37595 – result: transparent background, renders with opaque white background using IE6 on WinXP

So, here's a patch to change the default to the last version.

gerritbot added a subscriber: gerritbot.

Change 188857 had a related patch set uploaded (by Bartosz Dziewoński):
Use transparent rather than white background for ImageMagick SVG thumbnails

https://gerrit.wikimedia.org/r/188857

Patch-For-Review

matmarex lowered the priority of this task from High to Medium.Feb 5 2015, 7:19 PM

Change 188857 merged by jenkins-bot:
Use transparent rather than white background for ImageMagick SVG thumbnails

https://gerrit.wikimedia.org/r/188857

matmarex removed a subscriber: gerritbot.