Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Convert SVG to PNG with GD

Tags:

php

svg

gd

I want to convert an SVG image to a PNG in PHP. I know how to do it in Imagemagick but I dont get it to work on my Webserver and it seems SVG support is not very good with imagemagick.

So how can I do it with GD and is SVG even supported?

like image 513
Niko Lang Avatar asked Feb 06 '15 08:02

Niko Lang


People also ask

Can I convert an SVG file to PNG?

Use Adobe Photoshop to convert SVG images to PNG images. Get lossless compression, preserve image resolution, and lower your file size by converting from SVG to PNG. Use Photoshop for a fast way to turn large file formats into smaller, easier-to-use graphic types.

How do I convert SVG to PNG on Mac?

Then, you can convert the SVG file to PNG. Open the File menu and select Export As. Then, choose Select File Type and choose PNG as the export format. Finally, hit Export to commence the conversion process.


1 Answers

Sadly, GD2 does not support SVG. I had to install a unix virtual machine and I am trying with Imagick, that supports SVG.

like image 195
Niko Lang Avatar answered Sep 29 '22 15:09

Niko Lang