Polyline draw produces unexpected results.

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
richerm
Posts: 8
Joined: 2013-03-06T11:37:21-07:00
Authentication code: 6789

Polyline draw produces unexpected results.

Post by richerm »

Code: Select all

convert -size 250x250 xc:#FFFFFF -stroke red -fill none -strokewidth 5 -draw "polyline 100,100 200,100 200,200 100,200 100,100"  "Output.png"
This produces a perfect square in red (as expected).

Code: Select all

convert.exe -size 250x250 xc:#FFFFFF -stroke red -fill none -strokewidth 5 -draw "polyline 100,100 200,100 100,100"  "Output.png"
I then attempt to draw the top line of the rectangle then go back to the start of the line. I was expecting the result of a single red line, but instead I got a weird X pattern produced.

Code: Select all

convert -size 250x250 xc:#FFFFFF -stroke red -fill none -strokewidth 5 -draw "polyline 100,100 200,100 200,200 100,200 100,100 100,100 200,100 200,200 100,200 100,100"  "Output.png"

Code: Select all

convert.exe -size 400x400 xc:#FFFFFF -stroke "rgba(255,0,0,1.00)" -fill none -strokewidth 5 -draw "polyline 100,100 200,100 200,200 100,200 100,100 100,200 200,200 200,100 100,100"  "Output.png"
Interestingly enough, if I draw the rectangle twice, in the same direction I do not get this result. But if I draw once in one direction then back in the other I get a different result. Thoughts?

Version: ImageMagick 6.9.0-7 Q16 x86 2015-02-18
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Polyline draw produces unexpected results.

Post by Bonzo »

In your bottom two examples I can see you have nine sets of coordinates in one command and ten in the other. One command has 100,100 twice have you tried removing one of the 100,100 or adding an extra set of coordinates to the other command?
richerm
Posts: 8
Joined: 2013-03-06T11:37:21-07:00
Authentication code: 6789

Re: Polyline draw produces unexpected results.

Post by richerm »

Good catch, that was a bad copy/paste on my part, as this is a skimmed down version of the real issue I'm facing (the polyline is hand drawn so coordinates can be confusing so I simplified it).

Below are the two updated commands ( same results - one that makes sense, another with a 'glitch' ).

Code: Select all

convert.exe -size 250x250 xc:#FFFFFF -stroke "rgba(255,0,0,1.00)" -fill none -strokewidth 5 -draw "polyline 100,100 200,100 200,200 100,200 100,100 200,100 200,200 100,200 100,100"  "Output.png"

convert.exe -size 250x250 xc:#FFFFFF -stroke "rgba(255,0,0,1.00)" -fill none -strokewidth 5 -draw "polyline 100,100 200,100 200,200 100,200 100,100 100,200 200,200 200,100 100,100"  "Output.png"
Post Reply