7

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?

Niko Lang
  • 847
  • 2
  • 9
  • 17
  • just out of interest why couldnt you do it with imagemagick ? – Pogrindis Feb 06 '15 at 09:02
  • related `article` anyway http://stackoverflow.com/questions/4809194/convert-svg-image-to-png-with-php – Pogrindis Feb 06 '15 at 09:04
  • @Pogrindis I don't get it to work on my Windows Apache Server. – Niko Lang Feb 06 '15 at 09:08
  • was Imagemacik properly installed etc ? Things not working is suspicious! :) As for GD im doing poc now – Pogrindis Feb 06 '15 at 09:10
  • @Pogrindis Imagemagick was installed on my pc then I put the php_imagick.dll into the /ext/ folder and then I loaded it in the php ini. Then restart. But it isnt loading. I did something wrong but I dont know what. GD2 worked perfectly. – Niko Lang Feb 06 '15 at 11:22

2 Answers2

6

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

Niko Lang
  • 847
  • 2
  • 9
  • 17
0

Nowadays you can rasterize SVG via GD with https://github.com/meyfa/php-svg

MichaelK
  • 143
  • 4