MVG Draw/Path and Larger strokewidths produces extra lines.

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
richerm
Posts: 8
Joined: 2013-03-06T11:37:21-07:00
Authentication code: 6789

MVG Draw/Path and Larger strokewidths produces extra lines.

Post 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?
Last edited by richerm on 2015-03-04T13:19:50-07:00, edited 1 time in total.
richerm
Posts: 8
Joined: 2013-03-06T11:37:21-07:00
Authentication code: 6789

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

Post 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(?)
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

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

Post 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.
snibgo's IM pages: im.snibgo.com
richerm
Posts: 8
Joined: 2013-03-06T11:37:21-07:00
Authentication code: 6789

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

Post 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
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

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

Post 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.
snibgo's IM pages: im.snibgo.com
richerm
Posts: 8
Joined: 2013-03-06T11:37:21-07:00
Authentication code: 6789

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

Post 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.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

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

Post 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.
snibgo's IM pages: im.snibgo.com
richerm
Posts: 8
Joined: 2013-03-06T11:37:21-07:00
Authentication code: 6789

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

Post by richerm »

Thanks! That'll do in the short-term, even if it is quite verbose :).
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

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

Post 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"
snibgo's IM pages: im.snibgo.com
Post Reply