New: SEO Blog Writer, a readable, checked blog post for your site every week. Pay once, download straight away.

See it
AI Skill Up
Browse skills

Exporting an SVG icon to PNG at every size

Icons are best drawn as SVG and shipped as PNG. Four reliable ways to convert, from sharp and rsvg-convert to headless Chrome, and settings for crisp edges.

An icon drawn as SVG is exact at every size. The platforms mostly want PNGs, so the last step of every icon job is conversion. Done well, every size is crisp; done badly, you get blurry small icons and missing gradients.

Render each size from the SVG

Do not export one 1024 PNG and shrink it. Render each size from the vector, so edges land on whole pixels at that size. The four reliable ways:

sharp, in Node

import sharp from "sharp";
for (const size of [1024, 512, 192, 180]) {
  await sharp("icon.svg", { density: 384 })
    .resize(size, size)
    .png()
    .toFile(`icon-${size}.png`);
}

rsvg-convert, on the command line

rsvg-convert -w 1024 -h 1024 icon.svg -o icon-1024.png

Inkscape

inkscape icon.svg --export-width=1024 --export-filename=icon-1024.png

Headless Chrome

Open the SVG in a page sized to the icon and take a screenshot. Slower, but it renders filters, blend modes and web fonts exactly as a browser does, which the others sometimes do not.

Settings that matter

  • Flatten for iOS. Remove the alpha channel on the App Store icon; see iOS icons and transparency.
  • Keep alpha for macOS and Android foregrounds. Those need transparency.
  • Convert text to paths before exporting, or fonts may not render.
  • Check the smallest sizes by eye. Some icons need a simpler version below 32 pixels.

For the list of sizes to render, see app icon sizes.

App Icon Foundry handles this with no packages to install: it uses sharp if your project has it, rsvg-convert, or Chrome for PNGs, and without any of them you still get every SVG.

Questions

What is the best tool to convert SVG to PNG?

For scripts, sharp in Node and rsvg-convert from librsvg are fast and reliable. Headless Chrome renders exactly as a browser would, which helps with SVGs that use filters or fonts.

Why is my PNG blurry?

The SVG was rendered at a small size and scaled up, or rendered at a density too low for the target size. Render each size directly from the SVG rather than resizing one PNG.

Why do my SVG gradients or filters look wrong in the PNG?

Renderers differ in how they support filters, masks and blend modes. If one tool drops an effect, try another, or render with a browser engine.

Or skip the afternoonand drop one in.