Page 1 of 1

MVG Draw/Path and Larger strokewidths produces extra lines.

Posted: 2015-03-04T13:13:08-07:00
by richerm
I had posted an issue over in Users with regards to polyline but based on my reading this seems to have been an issue for quite some time with no resolution in sight. Having said that there is an issue with draw and path (SVG) with higher stroke widths.

This draws properly.

Code: Select all

convert.exe -size 300x300 xc:#CCCCCC -stroke red -fill none -strokewidth 1 -draw "path 'M 252,168 L 254,156 254,148 254,138'" "D:\Output.png"
This draws the same thing but introduces a long trailing line.

Code: Select all

convert.exe -size 300x300 xc:#CCCCCC -stroke red -fill none -strokewidth 3 -draw "path 'M 252,168 L 254,156 254,148 254,138'" "D:\Output.png"
Note this seems to happen for any strokewidth bigger then 3. Any suggestions on the issue, fix or possible workarounds?

Re: SVG Draw/Path and Larger strokewidths produces extra lines.

Posted: 2015-03-04T13:17:38-07:00
by richerm
here is an even more trivial example:

Code: Select all

convert.exe -size 100x100 xc:#CCCCCC -stroke red -fill none -strokewidth 3 -draw "path 'M 20,56 L 20,48 20,38'" "Output.png"
I must be doing something fundamentally wrong(?)

Re: MVG Draw/Path and Larger strokewidths produces extra lines.

Posted: 2015-03-04T13:56:01-07:00
by snibgo
Seems like a bug to me. These two commands with v6.9.0-0 give different results, both wrong:

Code: Select all

convert.exe -size 100x100 xc:#CCCCCC -stroke red -fill none -strokewidth 3 -draw "path 'M20,56 L20,48 20,38'" "p1.png"

convert.exe -size 100x100 xc:#CCCCCC -stroke red -fill none -strokewidth 3 -draw "path 'M20,56 L20,48, 20,38'" "p2.png"
The second command contains an extra comma.

Re: MVG Draw/Path and Larger strokewidths produces extra lines.

Posted: 2015-03-17T05:35:28-07:00
by richerm
So does this mean it is acknowledged as a bug by the developers, or just that you, as a moderator agree? Is there a typical timeline for when the devs reply with anything? Just not sure of the process.

Thanks.

Matt

Re: MVG Draw/Path and Larger strokewidths produces extra lines.

Posted: 2015-03-17T05:46:31-07:00
by snibgo
I'm not a developer. I just remove spam, make the coffee, and so on.

It looks like a bug, and not just a single bug, but the code is too complex for me to easily figure out what it should do, let alone what it actually does.

I expect the developers have seen this thread. They may have put it on the "Eek! Difficult!" pile.

Re: MVG Draw/Path and Larger strokewidths produces extra lines.

Posted: 2015-03-17T06:19:34-07:00
by richerm
I was afraid of that (the difficulty) based on some reading with strokewidths here and their 'weird' behavior.
http://www.imagemagick.org/Usage/draw/#strokewidth

I originally tried to draw with regular polyline but met with similar results. Are you aware of any workaround I can do to draw random path (i.e. user was drawing with a pen type tool on the screen) with specified line width? Interestingly enough it get fixes when strokewidth < 3. I have a feeling this is no as well but just checking.

Thanks.

Re: MVG Draw/Path and Larger strokewidths produces extra lines.

Posted: 2015-03-17T06:43:25-07:00
by snibgo
You might draw each segment seperately, eg (Windows BAT syntax):

Code: Select all

%IM%convert.exe ^
  -size 100x100 xc:#CCCCCC -stroke red -fill none -strokewidth 3 ^
  -draw "path 'M20,56 L20,48, M20,48 L20,38'" ^
  "p3.png"

%IM%convert.exe ^
  -size 100x100 xc:#CCCCCC -stroke red -fill none -strokewidth 3 ^
  -draw "path 'M20,56 L20,48'" ^
  -draw "path 'M20,48 L20,38'" ^
  "p4.png"

%IM%convert.exe ^
  -size 100x100 xc:#CCCCCC -stroke red -fill none -strokewidth 3 ^
  -draw "line 20,56,20,48" ^
  -draw "line 20,48,20,38" ^
  "p5.png"
I mostly use the method as in p5.png, and have never noticed any problems with it.

EDIT: My p5.png version had superfluous single-quotes.

Re: MVG Draw/Path and Larger strokewidths produces extra lines.

Posted: 2015-03-18T05:59:27-07:00
by richerm
Thanks! That'll do in the short-term, even if it is quite verbose :).

Re: MVG Draw/Path and Larger strokewidths produces extra lines.

Posted: 2015-03-18T06:13:41-07:00
by snibgo
I forgot to mention another possibility, slightly less verbose:

Code: Select all

%IM%convert.exe ^
  -size 100x100 xc:#CCCCCC -stroke red -fill none -strokewidth 3 ^
  -draw "line 20,56,20,48 line 20,48,20,38" ^
  "p6.png"
The draw commands can be put in a file:
pline.txt:

Code: Select all

line 20,56,20,48 line 20,48,20,38

Code: Select all

%IM%convert.exe ^
  -size 100x100 xc:#CCCCCC -stroke red -fill none -strokewidth 3 ^
  -draw "@pline.txt" ^
  "p7.png"