tdan on  wrote...
| 
| Goal: Draw a dashed border around an existing photo with known dimensions.
| Problem: My method creates a dashed border which is too thin.  It does not
| appear like a border.
| Progress:
| - I drew a transparent border around the image because I did not want the
| border drawn on the image itself.
|  I wanted it to act like a border or frame, hugging the image.
| - I used 4 draw commands so that the pathlines were straight and would not
| 'jump' between edges (try it with 1 path command).
| 
| 
| For testing try this:
| convert rose: -resize 300x200! –background none –border 20 –bordercolor 
none
| -strokewidth 20 –stroke blue –fill none
| -draw “stroke-dasharray 20 20 path 'M 0,0 h 300' ”
| -draw “stroke-dasharray 20 20 path 'M 300,0 v 200' ”
| -draw “stroke-dasharray 20 20 path 'M 300, 200 h -300' ”
| -draw “stroke-dasharray 20 20 path 'M 0, 200 h -200' ”
| 

Couple of points...
 * Ensure a transparency or matte channel exists in the image before
   adding the transparent color.  I think -border did this automatically
   but some operators don't.
 * set your "-bordercolor"  before you use it with "-border"
 * You do not need a "-background" color
 * use normal ASCII double quotes, not the word or UTF quotes.
 * You can just draw the borders using 'rectangle'
 * image coordinats go from 0 to  1 less that the wimage width/height
 * The lines width is centered on the line!
 * Finnaly specify an output name, even if it is just "x:" for the
   normal display.

Also there is a small known bug in that the 'off' lengths of the dash
array is one short. this will hopehully be fixed soon.

Here is the revised version...

   convert rose: -resize 300x200\! -matte -bordercolor none -border 20
   -strokewidth 20 -draw 'stroke-dasharray 20 20 stroke blue fill none
   rectangle 9,9 330,230"   rose_test.png

Okay with this I can see why you like to use seperate lines rather than
a rectangle, but the other points are valid.

| If you try this from the command line, you will see the dashed line really
| is not 20px wide (at least on my monitor).
| Instead, it appears offset from the image ~9 pixels or so.

of course it isn't  half your line was draw outside the image borders!

| Is this an issue with SVG having different resolution than IM's native
| resolution?

It is an issue of your coordinate placement.


  Anthony Thyssen ( System Programmer )    <[EMAIL PROTECTED]>
 -----------------------------------------------------------------------------
  He decided the physicists were wrong.  The universe was held together
  not by gravity, but by ifs.             -- Alan Dean Foster, "Quozl"
 -----------------------------------------------------------------------------
     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

Reply via email to