Noel da Costa on wrote...
| Thanks for the reply Pete,
|
| That got me a bit closer, but... try it with a stroke width of 7 and a
| -size of 2rx2r.. and you'll see the problem :)
| I want the final image size to perfectly fit the outer edge of the
| stroke
|
| I can come close using your formula slightly modified. The problem is
| that the strokewidth causes the resulting circle to be bigger than
| than the radius specifed. It seems to me that the stroke is centered
| on the circumference, so that if it is 8 pixel stroke, 4 will be
| inside the specified radius and 4 outside (not sure what happens for
| odd stroke widths!). Which means that the image size and x,y needs to
| be adjusted by half the stroke width.
|
| ...so here's an example with strokewidth 8 and radius 30.
|
| convert -size 64x64 xc:skyblue -fill white -stroke black -strokewidth
| 8 -draw "circle 32,32,60,32" /tmp/test.gif
|
| ... which comes pretty close, but the bottom and right edges of the
| image are missing a pixel of width.. so the resulting image looks
| truncated.
|
|
| How can I correct for this?
|
the problem is that an image which is 64x64 pixels, has pixel positions
counting from 0 to 63 and not 64.
because of this the center of the image is NOT 32 but 31.5
Now as you want a stroke width of 8, that means the radius of the circle
should be 4 pixels in from the edge (1/2 the strokewidth), so we get...
convert -size 64x64 xc:skyblue -fill white -stroke black \
-strokewidth 8 -draw "circle 31.5,31.5 4,31.5" /tmp/test.gif
Perfect fit!!! You just need to do the math right.
Anthony Thyssen ( System Programmer ) <[EMAIL PROTECTED]>
-----------------------------------------------------------------------------
The generation of random numbers is too important to be left to chance.
-- Tom Christiansen <[EMAIL PROTECTED]>
Anyone attempting to generate random numbers by deterministic means is,
of course, living in a state of sin. -- Von Neumann
-----------------------------------------------------------------------------
Anthony's Home is his Castle http://www.cit.gu.edu.au/~anthony/
_______________________________________________
Magick-users mailing list
[email protected]
http://studio.imagemagick.org/mailman/listinfo/magick-users