Page 1 of 1

Drawing to svg doesn't seem to work right?

Posted: 2009-05-20T11:13:19-07:00
by daviddoria
Taking an example from the help,

Code: Select all

convert -size 100x60 xc:skyblue -fill white -stroke black -draw "path 'M 30,40 A 30,20 20 0,0 70,20 A 30,20 20 1,0 30,40 Z '" arc.png
produces a bitmap with a blue background and a white ellipse with a black outline.

However, if you change the extension of the output

Code: Select all

convert -size 100x60 xc:skyblue -fill white -stroke black -draw "path 'M 30,40 A 30,20 20 0,0 70,20 A 30,20 20 1,0 30,40 Z '" arc.svg
convert arc.svg arc.png
I get a white background and a black ellipse.

What I am really trying to do is draw vector graphics on top of an existing bitmap image:

Code: Select all

convert myimage.png -fill white -stroke black -draw "line 0,0 100,30" output.svg
Anyone see where I am going wrong?

Thanks,

Dave

Re: Drawing to svg doesn't seem to work right?

Posted: 2009-05-21T19:47:52-07:00
by anthony
If you are wanting to draw vector images on bitmaps, why are you saving as a vector image?



IM is not a vector image processor. yes it can read in vector image, but it can't true output vector images, only raster images embedded ina vector image.

See A word about Vector Image formats
http://www.imagemagick.org/Usage/formats/#vector

Somthing that I mention repeatedally on the forums.


SVG is even worse in that you can not even embed a raster image into that format.
however recent IM's will make use of the library "AutoTrace" (also a program). This program attempts to convert a raster into a vector image. For many images it works reasonably well with only some smoothing and distortion. But it will NEVER reproduce a true raster image.

See IM examples. SVG Output handling
http://www.imagemagick.org/Usage/draw/#svg_output

also a method of making use of that output to create smooth outlines from pure black and white bitmap images.
Edging using a Raster to Vector Converter
http://www.imagemagick.org/Usage/transform/#edge_vector

From this you should see IM does not do what you are expecting, as it is not a true vector image processor!

Re: Drawing to svg doesn't seem to work right?

Posted: 2009-05-22T04:20:45-07:00
by daviddoria
Thanks Anthony. I did see a few notes about how it is not designed to do this, but it seems to be able to do almost everything else, so I thought there may be some 'workaround'! For anyone reading this - my next move is looking into inkscape's xml scripting for automatically drawing vector graphics (ie given a file full or coordinates, draw vector lines between them all).

Dave

Re: Drawing to svg doesn't seem to work right?

Posted: 2009-05-24T17:30:33-07:00
by anthony
You may also like to look at the 'Fig' file format and the XFig or related client programs. It is in many ways similar to inkscape but with a much simpler and very well defined vector file format.