Page MenuHomePhabricator

[BUG] Fix weird color changing issues with PNGs generated in SVG Translate
Closed, ResolvedPublicBUG REPORT


This is a very fun bug!

Steps to reproduce:

  1. Go to
  2. Wait a few seconds for the file to load.
  3. While initially the file loads correctly (red labels), the labels change color a second later -
SVG Translate fileCommons file
image.png (926×1 px, 411 KB)
image.png (990×1 px, 487 KB)

Acceptance criteria:

Fix the issue and make sure it does not happen for any other files either.

Event Timeline

Niharika triaged this task as Medium priority.Jan 16 2019, 4:05 PM
Niharika created this task.

The file that loads initially is also being produced by our invocation of rsvg, so it seems like that the error is being introduced by our manipulation of the SVG. (This is good.)

We should be able to add a test based a minimal part of the above SVG file to confirm that we're modifying all the tspan's attributes correctly. I wonder if some part of the style attribute is malformed?

The file has text element stroke and fill properties countermanded by tspan elements. Generally, text should not be stroked in an SVG file unless one is looking for special effects. The "Pinna" rendering is the most dramatic for the bug. Look at "Pinna" in the tool's rendering; only the strokes are visible and the fill is none. On Commons, the text is not stroked but filled with saturated red.


The tool is using the text element paint context when it should be using the tspan context.

Other text has the red fill in the text element; text looks darker and bolder in the tool due to the black 1px stroke.

MBinder_WMF changed the subtype of this task from "Task" to "Bug Report".Mar 26 2019, 11:04 PM
dom_walden added a subscriber: dom_walden.

I was not able to reproduce this on staging or production, using the svg in the description. I also compared the SVG downloaded from svgtranslate with the one from Commons. The <tspan> style attribute is being preserved correctly.

Lots of visual comparisons of svgtranslate and Commons was done in T215580#5115279 (and incidentally as part of other testing). While there can sometimes be differences in font rendering (probably due to rsvg), nothing like described here.

Suggesting this is fixed.

dom_walden claimed this task.
dom_walden moved this task from Backlog to Done on the SVG Translate Tool board.
dom_walden moved this task from Ready to Done on the Community-Tech-Sprint board.