Convert SVG image to PNG with PHP Imagick and preserve opacity on elements
Posted: 2017-08-08T08:03:56-07:00
I am having an issue with converting a SVG image to PNG with PHP using IMagick and preserving opacity on some SVG elements. I had a windows server and used Imagick from command line to convert SVG to PNG and everything worked great. I am now switching to PHP website on a unix server and I am using PHP IMagick.
It converts the file and preserves background transparency fine. I have a bunch of elements in the SVG that get turned on and off and then converted to a PNG. The PHP IMagick does not seem to handle opacity on an element in SVG though. If I view the SVG in my browser it is correct, just the converted file is incorrect.
I have tried the following on elements and none of them seem to hide the elements.
style="opacity: 0;"
opacity="0"
visibility="hidden"
Is this a known issue with Imagick or am I missing something here.
It converts the file and preserves background transparency fine. I have a bunch of elements in the SVG that get turned on and off and then converted to a PNG. The PHP IMagick does not seem to handle opacity on an element in SVG though. If I view the SVG in my browser it is correct, just the converted file is incorrect.
I have tried the following on elements and none of them seem to hide the elements.
style="opacity: 0;"
opacity="0"
visibility="hidden"
Is this a known issue with Imagick or am I missing something here.