Ho bisogno dello stesso output di Inkscape e Imagick.Imagick non rende correttamente l'opacità svg
Questo è il risultato previsto, esportato da Inkscape.
Tuttavia, il codice PHP sotto emette il seguente risultato difettoso.
codice PHP: Codice
<?php
$im = new Imagick();
$im->setResolution(400,400);
$im->setBackgroundColor(new ImagickPixel('transparent'));
$im->readImageBlob(str_replace(array("color1", "color2"), array("yellow", "blue"), file_get_contents("img.svg")));
$im->setImageFormat("png");
header("Content-type: image/png");
echo $im;
?>
SVG:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="400" height="400">
<rect width="100%" height="100%" fill="green" />
<path d="M250 150 L150 350 L350 350 Z" opacity="0.9" fill="color1" />
<path d="M150 50 L50 250 L250 250 Z" opacity="0.9" fill="color2" />
</svg>
Perché hai bisogno di usare Imagick? È più facile da fare con i veri programmi SVG. – jmz
Ho provato su Windows 7 64bit 2.3.0 stesso problema. Su Linux con 3.1 funziona come dovrebbe. – RedRoosterMobile