svg in memory string to Magick::Image

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
andyrd
Posts: 2
Joined: 2014-07-18T13:06:03-07:00
Authentication code: 6789

svg in memory string to Magick::Image

Post 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?
andyrd
Posts: 2
Joined: 2014-07-18T13:06:03-07:00
Authentication code: 6789

Re: svg in memory string to Magick::Image

Post 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);
Post Reply