Page 1 of 1

svg in memory string to Magick::Image

Posted: 2014-07-18T13:10:50-07:00
by andyrd
Using the C++ API, how would I go about getting an svg string that's in memory (e.g. std::string) in to a Magick::Image object rather than reading the svg from a file?

Re: svg in memory string to Magick::Image

Posted: 2014-07-21T09:27:06-07:00
by andyrd
For posterity, I accomplished this by loading the string in to a Magick::Blob and then setting the magick parameter on the Magick::Image to "SVG",

Code: Select all

std::string svgString = ...;

Magick::Blob svgBlob(svgString.c_str(), svgString.length());

Magick::Image svgImage;
svgImage.magick("SVG");
svgImage.read(svgBlob);