June 2010

Recipe for SVG to PNG with svg2png

The SVG files generated by Lineform have a viewBox attribute and no width and height attributes on the outermost svg element. This is good because it means that is necessary to get Webkit browsers (at least) to treat them as scalable (apparently the S in SVG was not enough of a hint). Alas! the svg2png utility I want to use to downgrade SVG files to PNG requires width and height attributes or it assumes nonsensical values. Here’s my silly recipe for achieving this without having two copies of every SVG file. Read more