Stroking an SVG file

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
praviarun

Stroking an SVG file

Post by praviarun »

Hi All,
I am new to the Imagemagick api.. and so forgive me if this is a silly question...
I am writing an effect which would apply stroke for fonts...
So I read a png image using Image Magick and would like to convert this to a vector format (SVG) which is supported in image magick
as i have built magick with the autotrace library..

code...
Magick::Image im1;
im1.read("D:/Test/abc.png");
im1.write("D:/Test/abc.svg");
..................
My questions are as follows..
1)Can I get the path of this SVG data in memory without actually saving an SVG file in the hard disk
2)How do I apply stroke to this svg file using the C++ api

Thanks in advance
Praveen
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Stroking an SVG file

Post by fmw42 »

IM is not a good app for converting raster to vector

see http://www.imagemagick.org/Usage/formats/#vector
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Stroking an SVG file

Post by anthony »

SVG is a text format -- extract it from that file!

See... http://www.imagemagick.org/Usage/transform/#edge_vector
I do exactly that so I can modify the results to get a clean outline of a bitmap shape.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
praviarun

Re: Stroking an SVG file

Post by praviarun »

Hi,

Thanks for the help...

I have got it to work the way u say...but i still have to write an svg file and extract info from that..Is there no way I can get the entire svg information into memory without actually writing into a file...

Thanks
Praveen
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Stroking an SVG file

Post by anthony »

Well... Not really.

IM draw (using the internal MSVG decoder) does have a method of outputing the draw statements as IM draw operations. This however is for debugging, it is stored internally but their is no way to access.

In any case IM is a raster image processor, not a vector processor, so really this is beyond its scope.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply