SVG to PNG conversion produces pixelated output with height and width values
See original GitHub issueWhen resizing svg files and converting them to png, the output is really pixelated if
- the svg file has a height and a width specified in pixels and
- the size it should be resized to is larger than these values.
I would expect svgs to be resized properly, no matter if a height and a width are specified.
Sample project
https://github.com/nikwen/sharp-demo/tree/svg-resize-height-width (make sure you are on the svg-resize-height-width
branch)
Sample image conversion
Source (32x32px): https://github.com/nikwen/sharp-demo/blob/svg-resize-height-width/image.svg Result (512x512px): https://github.com/nikwen/sharp-demo/blob/svg-resize-height-width/out.png
Issue Analytics
- State:
- Created 5 years ago
- Comments:16 (3 by maintainers)
Top Results From Across the Web
In python convert SVG to PNG while resizing and increasing ...
So I need to take an SVG and produce a PNG with width w and height h and specific dpi. I want to...
Read more >ImageMagick Convert: How to produce sharp resized PNG ...
The problem is the width="16px" height="16px" in the SVG file. Try changing the ImageMagick command to convert -resize 3200% pinterest.svg pinterest.png for a ......
Read more >SVG to PNG Converter - CloudConvert
Convert scalable vector images to PNG with CloudConvert! Our conversion technology preserveres transparency and allows to scale lossless the vector to any ...
Read more >Export SVG to PNG in Inkscape - Davies Media Design
In this Inkscape tutorial, I show you how to export svg files to png images using Inkscape! Convert your vector graphics to PNG...
Read more >Converting dynamic SVG to PNG with node.js, d3 and ...
One option to provide backwards compatibility is to rasterize SVG to a static image. This saves you from creating a pixel-perfect alternate ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hello, did you see the density property to set the DPI at which to render vector images?
This is some super rough code that seems to work ok: