Page 1 of 1

How to convert an image with one kind of stroke to another?

Posted: 2014-09-02T09:23:32-07:00
by ooker
I have an image like this: Image
I want to convert it to dash line only. I have tried

Code: Select all

convert input.png -draw "stroke-dasharray 10 3 3 3" output.png
or

Code: Select all

convert input.png -draw "stroke-dasharray 10 3 3 3  path 'M 10,40 L 90,40'" output.png
as in http://www.imagemagick.org/Usage/draw/#mvg_settings but haven't met any success. The output is unchanged. Do you have any ideas? Thank you.

Re: How to convert an image with dash line only to stroke li

Posted: 2014-09-02T10:06:24-07:00
by fmw42
Your blue line is not dashed.

Perhaps I misunderstand. But you cannot change a line that has already been drawn to some other stroke type. You would have redraw it from scratch or clear out the old line by filling over it and then draw the new stroke type in the same positions.

If you want to draw a line with a strokewidth and color with or without dashes, see http://www.imagemagick.org/Usage/draw/#strokewidth

Re: How to convert an image with one kind of stroke to anoth

Posted: 2014-09-02T10:36:41-07:00
by ooker
Sorry for my bad English. I have checked the dictionary again and edit the post to make it clearer. Hopefully this time you won't be confused.

The blue line isn't in my image, maybe it's from the forum or the image host. I don't know.

So I can't do that, is that right?

Re: How to convert an image with one kind of stroke to anoth

Posted: 2014-09-02T14:51:40-07:00
by fmw42
Your image is a raster image. So you cannot change the kind of stroke from simple to dashed. That is only possible if you have a vector image such as SVG. If you want to make the yellow lines in the image wider or narrower, you can use -morphology dilate or erode. see http://www.imagemagick.org/Usage/morphology/#basic

The only way to make dashed lines is to composite your alpha channel with an image of a checkerboard pattern.

see
viewtopic.php?f=1&t=25970&start=15#p114991

Re: How to convert an image with one kind of stroke to anoth

Posted: 2014-09-03T11:37:48-07:00
by ooker
Let's say that I have a vector image. What should I do?

Re: How to convert an image with one kind of stroke to anoth

Posted: 2014-09-03T11:57:22-07:00
by snibgo
Use a vector editor such as Inkscape.

Re: How to convert an image with one kind of stroke to anoth

Posted: 2014-09-03T14:44:10-07:00
by ooker
Doesn't Imagemagick support that?

Re: How to convert an image with one kind of stroke to anoth

Posted: 2014-09-03T14:54:28-07:00
by snibgo
ImageMagick can do some things with vectors, like rasterising them or (to a limited degree) vectorising a raster, but it isn't a general-purpose vector editor.

If you can open your vector file in Inkscape, you can easily do anything you want with the lines: change width, colour, style, dot-dash-dot, whatever you want. You can convert it to SVG and then use text tools to manipulate the image: change the lines, remove lines, add new lnes, whatever.

Re: How to convert an image with one kind of stroke to anoth

Posted: 2014-09-04T02:17:38-07:00
by ooker
I get that. Thank you.