Community Wishlist Survey 2021/Multimedia and Commons/SVG to PNG converter that actually works

SVG to PNG converter that actually works

  • Problem: Current SVG to PNG conversion is buggy, many images that work in Inkscape and major browsers are broken upon conversion on Commons. Blurs are cropped most of the time, clones behave unpredictably, hatch fills work on some resolutions and don't on others. The conversion library, librsvg, is no more being developed.
  • Who would benefit: Creators of highly-desirable high-quality SVG media
  • Proposed solution: Use Inkscape in batch mode for conversion on wikimedia servers - at least for files created in Inkscape, or per uploader's choice. How do browsers render SVG graphics, can their library be used for svg to png conversion?
  • More comments:
  • Phabricator tickets: phab:T243893 phab:T40010 phab:T193352
  • Proposer: Ponor (talk) 04:33, 17 November 2020 (UTC)[reply]

Discussion

  • Yeah not being able to use stuff like textpaths -- which work on every browser MDN lists -- really is annoying. This really doesn't seem like it would be that hard to implement at all, too. DemonDays64 (talk) 09:10, 17 November 2020 (UTC)[reply]
    @Ponor: Every complex software will have some software bugs. How to define "actually works"? If someone worked on this proposal, when to call work finished by which objective criteria? In my personal opinions this proposal is currently not discrete and well-defined. --AKlapper (WMF) (talk) 14:00, 17 November 2020 (UTC)[reply]
    @AKlapper (WMF):No one uses librsvg to make SVG images, but some (or most?) use Inkscape. So if I made my SVG in it, and it worked fine for me in Firefox and Chrome, I'd expect it to work on WP - but it often doesn't, and I need to go back to Inkscape, unlink all my clones, remove all my blurs, and make guesses what else might be "wrong" (nothing's wrong, the library is wrong). I was lucky to find this tool Commons_SVG_Checker so at least I didn't have to beg for speedy deletions of my uploads-gone-wrong. You'll say there are other users who do not use Inkscape. And that's fine, they'll still be able to use the abandoned library for svg2png conversion. Ponor (talk) 14:23, 17 November 2020 (UTC)[reply]
    Forgot to answer your question: call the work finished when we're using the newest stable version of Inkscape to do svg2png conversion (for Inkscape-generated SVGs at least)
  • Since all browsers (that WMF supports) support SVG now, why are we not serving SVG images instead? :) (I can see a case for 'it's a really large SVG don't want to DOS the servers, but that's something that can be worked around with some upper limit.) --Izno (talk) 18:38, 17 November 2020 (UTC)[reply]
    That said, there was a Phab discussion for switching the renderer at phab:T40010. Do consider. --Izno (talk) 18:45, 17 November 2020 (UTC)[reply]
    This is the best solution imo. svg -> png is clearly messy/error-prone and all major browser vendors have supported svg natively for years now. -FASTILY 04:55, 18 November 2020 (UTC)[reply]
    There is at least one other caveat (abuse like background-URL hacks) but these are things that can probably be worked around. --Izno (talk) 05:09, 18 November 2020 (UTC)[reply]
librsvg is actively developed [1], it is still the most common SVG-Renderer on Linux, most common bugs on commons are already fixed, the problem is that Wikimeida uses an outdated version from 2017, see phab:T193352.
Inkscape is developed for generating images, not for batch-converting, therefore it is much slower. (phab:T40010#6635936 @GDubuc (WMF): Can you name the current CPU-costs per day? in CPU-h/d or €/d )
Wikimedia should be used for image-exchange, therefore we don't wan't invalid Inkscape-Files which can only be rendered by Inkscape, we want SVGs that are valid according to the current SVG 1.1-Standard, otherwise it is Inkscape-file but not an more a SVG-file.
SVG-Experts have different opinions on that, because it is a complex topic.
@Glrx: for example: Prefers a native SVG-Rendering by the clients-Browser, however this would be a much larger change than updating or changing the renderer, and has also several disatvantages (Maleware-Safety issues, different rendering on the individual browser, missing fonts, increased client-rendering-time, ...)
I support the proposal, although I expect complications and problems.
However I think resvg by @RazrFalcon: might be a better renderer (very much faster and generally better SVG-Support).
 — Johannes Kalliauer - Talk | Contributions 06:19, 9 December 2020 (UTC)[reply]
I actually go so far as to oppose this proposal as a waste of time. Work instead on serving SVG directly. Globbet (talk) 22:39, 9 December 2020 (UTC)[reply]
@Globbet: I might have been unclear about direct SVG-serving, due to security-reasons, unpredicted client-side-rendering, huge SVG-files with several minutes of rendering, it is imho not a good idea in general. Due to different browser you will get several bugs. Brower-rendering should imho only be an opt-in in the preferences for specific flagged svg-files, see Special:Diff/20781745 for details.  — Johannes Kalliauer - Talk | Contributions 10:54, 10 December 2020 (UTC)[reply]

Voting