GNOME Bugzilla – Bug 413617
Background color option for rsvg
Last modified: 2007-03-01 21:10:50 UTC
We at Wikimedia would like both librsvg and the rsvg command line utility to expose an option for PNG background colour. We are currently using a patch to force the background colour to white, which is necessary for correct printing from Firefox on Windows or Linux. In librsvg, it is implicitly hard-coded to black. For more details and our provisional patch, please see the Wikimedia bug report: http://bugzilla.wikimedia.org/show_bug.cgi?id=4968
This should be possible with rsvg-convert, given a little effort. rsvg-view does something like this, but that's due to Netscape plugin limitations. For this to work, we'd probably have to composite a solid color over the cairo surface before handing it to rsvg_cairo_render(). I just wonder if this is a slippery slope sort of thing. I.e. will people want arbitrary images or gradients next? Couldn't this be done outside of librsvg using one of ImageMagick's command-line utilities, or a custom-written libpng-based program? And to be technically correct, you'd want to composite the PNG over the page's background color or image, not just "white". Further, this is an issue for Firefox printing translucent images. This is a Firefox bug, not a librsvg bug. Hopefully this is fixed in the cairo-enabled Firefox3 builds due to cairo's smart fall-back rendering strategies. If this is to be done at all, I would strongly prefer doing this as a post-processing step rather than complicating rsvg-convert. For these reasons, I think that is is a "WONTFIX" issue. Thanks for the bug report.