Page 1 of 1
Driving me up the wall trying to make a rectangle!
Posted: 2012-07-28T06:26:03-07:00
by ultranerds
Hi,
I know I'm gonna get a lot of stick for this, but I'm really struggling trying to get a rectangle made over an image. So far I have read this page:
http://www.imagemagick.org/script/comma ... .php?#draw
From what I understand about the co-ordinate system, I need:
convert ./wintercard1.jpg -fill white -stroke black -draw "rectangle 0,0 50,600 gravity South" ./wintercard1_new3.jpg
However, that makes a vertical (600px high, 50px wide) rectangle. My rectangle needs to be at the base of the image, and 50 high + 600 wide. Can someone suggest what I'm doing wrong? Maybe I'm mis-understanding how the coordinates system works?
TIA!
Andy
Re: Driving me up the wall trying to make a rectangle!
Posted: 2012-07-28T06:44:51-07:00
by Bonzo
In your code: 0,0 = rectangle top left corner 50,600 = bottom righthand corner so you are getting what you as for; try -draw "rectangle 0,0 600,50 gravity South". I do not know if gravity has any effect in the draw command.
Re: Driving me up the wall trying to make a rectangle!
Posted: 2012-07-28T10:45:16-07:00
by fmw42
Bonzo wrote:In your code: 0,0 = rectangle top left corner 50,600 = bottom righthand corner so you are getting what you as for; try -draw "rectangle 0,0 600,50 gravity South". I do not know if gravity has any effect in the draw command.
you probably need to put -gravity south outside and before the -draw command
Re: Driving me up the wall trying to make a rectangle!
Posted: 2012-07-29T03:36:37-07:00
by ultranerds
Hi,
Thanks for the replies guys. The box is the right size now, but the damn thing is refusing to draw at the bottom of the image :/
Code: Select all
convert ./wintercard1.jpg -fill white -stroke black -gravity south -draw "rectangle 0,0 600,50" ./wintercard1_new3.jpg
I've also tried "South" (ie uppercase S)... and that doesn't work either
TIA
Andy
Re: Driving me up the wall trying to make a rectangle!
Posted: 2012-07-29T05:23:21-07:00
by Bonzo
I still do not know if you can use -gravity with draw as it is referancing the top left corner.
This will work:
Code: Select all
convert ./wintercard1.jpg ( -size 598x48 xc:white -bordercolor black -border 1x1 ) -gravity south -composite wintercard1_new3.jpg
Re: Driving me up the wall trying to make a rectangle!
Posted: 2012-07-29T11:21:36-07:00
by fmw42
I can confirm that
convert logo: -fill red -stroke black -gravity southeast -draw "rectangle 0,0 100,100" show:
does not honor -gravity.
I think -gravity is only sensitive in the following context for -draw
http://www.imagemagick.org/Usage/layers/#draw
So using -composite as Bonzo said is likely the best way.
Re: Driving me up the wall trying to make a rectangle!
Posted: 2012-08-07T19:26:08-07:00
by anthony
gravity only effects text and image placement (and justification! - sic). It is not part of SVG so is not really used for other primitive draw commands.