I'm running ImageMagick 6.7.4-0 and Imagick 3.0.1.
I have all of the delegates necessary for SVG (output of convert -list configure | grep DELEGATES
shows bzlib djvu fontconfig freetype gvc jpeg jng jp2 lcms lqr openexr png rsvg tiff x11 xml wmf zlib
).
Here is some sample PHP code to convert a very simple SVG into a PNG:
$file = 'baseball.svg';
$im = new Imagick();
$im->readImage($file);
$im->setImageFormat("png32");
header("Content-Type: image/png");
print $im->getImageBlob();
I get a 503 response from the server; PHP reports nothing and logs nothing. I have all php errors enabled, display errors enabled, log errors enabled, etc. I can convert from .png to .jpg and all of that just fine.
And an important note -- I was able to work with SVGs just fine for several months on this server, but I had to upgrade ImageMagick from 6.6.x to 6.7.x to get some bugs worked out in relation to text distortion. I first tried the latest release (6.7.4-10) but couldn't get any conversion to work, so I downgraded to 6.7.4-0 and all conversions except for SVG work again. I just can't sort this one out!
Edit: Running on Ubuntu 10.04. Server is Litespeed 4.0.10.
Edit 2: I have just discovered that this code -- when run from the command line (php test.php
) -- actually does create the .png from the .svg perfectly, even though it reports "Segmentation fault". Running this script from the browser does not produce any file.
$file = 'baseball.svg';
$im = new Imagick();
$im->setBackgroundColor(new ImagickPixel('transparent'));
$im->readImage($file);
$im->setImageFormat("png32");
$fp = fopen(time() . '.png', 'w');
fwrite($fp, $im->getimageblob());
fclose($fp);
I tried ImageMagick 6.7.x along with every combo of Imagick versions, no luck (always segfaults, but command line PHP is able to create the file at least)
I tried ImageMagick 6.6.x along with every combo of Imagick versions, still no luck (always segfaults, command line PHP is not able to create anything).
I tried adding all required and suggested dependencies for ImageMagick, and yet, stil no luck.
I removed Imagick, uninstalled ImageMagick, and then ran apt-get install libmagickcore3-extra imagemagick --fix-missing
. Then ran pecl install imagick-3.0.1
.
Voila, all working as expected, but back to where I was before I attempted to upgrade ImageMagick. I cannot seem to get a self-compiled version of ImageMagick/Imagick fully working with SVGs on Ubuntu.