Page 1 of 1

"no decode delegate" for 1 SVG, while all others work fine

Posted: 2011-12-29T17:20:31-07:00
by charlie1234
I wrote a script which parses SVGs and breaks them down into layers, saving the individual layers as PNGs as well as the 1 original SVG as a PNG.

Ran through hundreds of SVGs without a problem, but this current file is being troublesome. I'm getting the good ol' "no decode delegate" error when I perform $image->readImageBlob() on the contents of the SVG file:

Code: Select all

magickException: no decode delegate for this image format `' @ error/blob.c/BlobToImage/349 in Imagick->readimageblob()
The line in my PHP script that is throwing the error is:

Code: Select all

$im->readImageBlob($svg_blob);
where $svg_blob is simply the result of file_get_contents('path/to/svg').

I can probably work with the content of this SVG (attached to this post) in a graphics program to get it working within the canvas of another (known working) SVG, but I am very curious what the actual problem with this file is as it's virtually identical to what I've already been using. Anyone have a clue?

Re: "no decode delegate" for 1 SVG, while all others work fi

Posted: 2011-12-29T19:32:32-07:00
by magick
That particular SVG image is prefixed with a couple of binary characters which throws off ImageMagick such that it does not recognize the image as SVG. To fix, set the format explicitly with
  • $im->setFormat('SVG');

Re: "no decode delegate" for 1 SVG, while all others work fi

Posted: 2011-12-30T19:30:42-07:00
by charlie1234
Thanks for your help magick! How were you able to see the prefixed binary characters?