问题
I want to convert SVG images to PNG files with transparent background. I am using below code to convert it using imagick in php,but it gives image with black background.
$image = new imagick();
//set transparent background
$image->setBackgroundColor(new ImagickPixel('transparent'));
$image->setFormat('svg');
$image->readImageBlob(file_get_contents("image.svg"));
$image->setImageFormat("png32");
$image->resizeImage(265,195, Imagick::FILTER_LANCZOS, 1);
$image->writeImage('result.png');
Can anyone please help me how to convert above svg image to png image using PHP. Any help would be appreciated.
来源:https://stackoverflow.com/questions/39661410/svg-to-png-image-conversion-in-php