2

I am trying to convert an SVG to PNG and keep the transparency, but that does not work. Instead, I get a black background.

This is my code:

$png = new Imagick();
$png->setBackgroundColor(new ImagickPixel("transparent"));
$png->readImageBlob($svg);
$png->setImageFormat("png32");

Thanks in advance!

2
  • Ok, I fixed it (finally) by upgrading to the newest version of ImageMagick (and IMagick) - weird that it didn't work before.
    – John Reese
    Mar 19, 2014 at 22:52
  • What specific version worked? I'm using 8:6.7.7.10-6ubuntu3 and saving a png imageblob with transparency turned black.
    – NoBugs
    Jan 18, 2015 at 6:14

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.