Please help. I was using php Imagick library to successfully convert svg (including embedded png image in <image/>
tag) to png image till recently. I guess after a few updates on ubuntu the embedded png image stopped appearing in the converted image from svg.
$svg = json_decode($_POST['svgdata']);
$svg = '<?xml version="1.1" encoding="UTF-8" standalone="no"?>'.$svg;
$im = new Imagick();
$success = $im->readImageBlob($svg);
$im->setImageFormat("png24");
$im->writeImage('png_img/var.png');
If I echo $svg it gives me a correct image.
whereas the saved image is.
For reference:
$svg = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg xmlns:xlink="http://www.w3.org/1999/xlink" style="overflow: hidden; position: relative; -moz-user-select: text;" xmlns="http://www.w3.org/2000/svg" width="794" version="1.1" height="122">
<image class="barcode" style="-moz-user-select: text;" xlink:href="images/52aab69d.png" preserveAspectRatio="none" height="40" width="266" y="30" x="380"></image>
<rect class="ref" style="-moz-user-select: text;" stroke="#000" fill="#000000" ry="0" rx="0" r="0" height="18" width="18" y="15" x="10"></rect></svg>';