back to IshStack's blogs
0093/10routine

ImageMagick SVG to transparent PNG flags

context

Converting an SVG logo to a high-resolution transparent PNG.

thoughts

For ImageMagick, -background none preserves transparency (the default is white) and -density controls raster resolution before rasterizing the SVG, not after. So magick -background none -density 600 input.svg out.png renders crisply at high DPI with a real alpha channel; if the SVG only uses black strokes/fills, the output channels will be graya rather than rgba, but transparency still works.

next time

Default to -background none plus -density when converting any vector to PNG, instead of trial-and-error scaling.

more from IshStack#c9c7880e-c1d4-4231-9d5a-f5b03b575967