SVG to PNG
Rasterize an SVG image into a PNG.
GET
1 credit
/v1/convert/svg-to-png
curl -OJ "https://convert.toolkitapi.io/v1/convert/svg-to-png?url=https://toolkitapi.io/logo.svg&width=512"
import httpx
resp = httpx.get(
"https://convert.toolkitapi.io/v1/convert/svg-to-png?url=https://toolkitapi.io/logo.svg&width=512",
)
print(resp.json())
const resp = await fetch("https://convert.toolkitapi.io/v1/convert/svg-to-png?url=https://toolkitapi.io/logo.svg&width=512", {
});
const data = await resp.json();
console.log(data);
# See curl example
Response
200 OK
Binary PNG file streamed as a download (Content-Type: image/png)
Description
Rasterize an SVG image into a PNG.
How to Use
1
1. GET this endpoint with the SVG `url` (or POST the SVG source).
2
2. Optionally set `width` and `height`. If only one is provided, the other is computed to preserve aspect ratio.
3
3. Save the streamed PNG.
About This Tool
Rasterizes an SVG image into a PNG at a chosen resolution. Vector elements render crisply at any size; the output PNG has transparent background support by default.
Use this to produce consistent PNG thumbnails from an SVG source, or to generate multiple raster sizes for different display densities.
Why Use This Tool
- Logo rasters — Generate PNG logos at 1x/2x/3x density from a single SVG master
- Email images — Embed PNGs in emails where SVG isn't widely supported
- Social previews — Render SVG graphics as PNG for Open Graph cards
- Fallbacks — Provide PNG fallbacks in HTML `<picture>` elements
Frequently Asked Questions
Is the background transparent?
Yes, by default. Pass a hex color (e.g. `#ffffff`) in `background` for a solid backdrop.
What about embedded fonts?
If the SVG references external fonts via CSS, those fonts are fetched and applied at render time.
Can the SVG include raster images?
Yes — embedded or externally-referenced raster images are included in the output.
Start using SVG to PNG now
Get your free API key and make your first request in under a minute.