Tôi cần cùng một đầu ra từ Inkscape và Imagick.Imagick không hiển thị đúng độ mờ svg
Đây là kết quả mong đợi, được xuất từ Inkscape.
Tuy nhiên, mã PHP dưới đây kết quả đầu ra kết quả bị lỗi sau đây.
mã PHP: Mã
<?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>
Tại sao bạn cần sử dụng Imagick? Nó dễ dàng hơn với các chương trình SVG thực. – jmz
Tôi đã thử nó trên Windows 7 64bit 2.3.0 cùng một vấn đề. Trên Linux với 3.1 nó hoạt động như nó nên. – RedRoosterMobile