Draw rectangle (non filled)
Draw rectangle (non filled)
I want to draw a rectangle at given coordinates but not filled, just the outline. How can I do this?
-
- Posts: 1015
- Joined: 2005-03-21T21:16:57-07:00
Re: Draw rectangle (non filled)
Use a transparent fill. e.g.:
Pete
Code: Select all
convert logo: -fill none -stroke black -strokewidth 3 -draw "rectangle 10,10 630,470" logo_rect.png
Sorry, my ISP shutdown all personal webspace so my MagickWand Examples in C is offline.
See my message in this topic for a link to a zip of all the files.
See my message in this topic for a link to a zip of all the files.
Re: Draw rectangle (non filled)
Thank you for that. Is there a way to create more than one rectangles at different areas of the image (except from the obvious, calling convert more than once)? If yes, how?
- fmw42
- Posts: 25668
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Draw rectangle (non filled)
I believe you can call several rectangles with the same -draw (in the quotes), but for sure you can string draw commands together in the same command line.
see http://www.imagemagick.org/Usage/draw/
see http://www.imagemagick.org/Usage/draw/
Last edited by fmw42 on 2010-09-29T19:27:16-07:00, edited 1 time in total.
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Draw rectangle (non filled)
You can either use multiple -draw commands on the same image, OR repeat the rectangle (or other draw MVG commands) in the same draw command string.
http://www.imagemagick.org/Usage/draw/#intro
You can also write all your MVG draw commands into a file and simply read that file as a draw command string, or as an image in its own right!
http://www.imagemagick.org/Usage/draw/#reading
http://www.imagemagick.org/Usage/draw/#intro
You can also write all your MVG draw commands into a file and simply read that file as a draw command string, or as an image in its own right!
http://www.imagemagick.org/Usage/draw/#reading
Anthony Thyssen wrote:There are lots of ways to skin a cat, and what method you use depends
on what you want that skin for, and how messy you like the results!
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
Re: Draw rectangle (non filled)
Thanks for that, it worked.
Now I want to circle the same area so I'm using -draw circle with the same coordinates as region, but the result makes a circle larger than the area expected. Is there a calculation formula that I can use to bring it down to the correct region?
Now I want to circle the same area so I'm using -draw circle with the same coordinates as region, but the result makes a circle larger than the area expected. Is there a calculation formula that I can use to bring it down to the correct region?
- fmw42
- Posts: 25668
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Draw rectangle (non filled)
circle wants two points, the center and a point on the perimeter of the circle. So if you want a circle to pass through the corners of the rectangle, then you need to find the center of the rectangle and use one point at the corner. If you want the circle to be tangent to two sides or 4 sides if a square, then you need the center of the rectangle and the center of one side of the rectangle.galv wrote:Thanks for that, it worked.
Now I want to circle the same area so I'm using -draw circle with the same coordinates as region, but the result makes a circle larger than the area expected. Is there a calculation formula that I can use to bring it down to the correct region?
see http://www.imagemagick.org/Usage/draw/#circles
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Draw rectangle (non filled)
You can also use arc which defines the 'circle' in terms of a bounding rectangle.
See Draw primatives
http://www.imagemagick.org/Usage/draw/#primitives
See Draw primatives
http://www.imagemagick.org/Usage/draw/#primitives
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/