Hacker News new | ask | show | jobs
by keyle 3217 days ago
I agree with you but as a 'old' developer, I find it pretty sad that you have to fire up a headless browser + its gigaton of code, to convert a SVG to PNG. But I agree with you, headless chrome can be very useful.
3 comments

We currently use Apache Batik (JVM/Scala) to generate PNG for server generated SVGs of charts. SVG is wonderful for generating charts, easy even without any framework.
I take your point in general, but I'm not sure this specific task - converting of SVGs - has ever been one that has easily been solved by some tiny amount of code: probably the way I would have done this in the past (say, ten years ago) would have been using Apache Batik's rasteriser, which is far from a lightweight solution itself.
It's not tiny, but in case anybody else is trying to do the same thing, I'd reach for librsvg (https://wiki.gnome.org/Projects/LibRsvg).
You could also do that with inkscape on the commandline, not sure if it's faster, though...