Page 1 of 1

Adding Borders

Posted: 2013-06-24T13:02:42-07:00
by helloworld
I am trying to add a black border to an image, Below are the original images and borders added to Horizontal, Vertical and Square images,

http://f.cl.ly/items/0P353a1K3P1Z1E2V2O ... antal1.jpg
http://f.cl.ly/items/2D1Q2N0e0y3g2Z1M0M ... lfinal.jpg
http://f.cl.ly/items/070r0S0C2E3T023L120v/Square1.jpg
http://f.cl.ly/items/34260C1m0b0F0f2h02 ... efinal.jpg
http://f.cl.ly/items/1Y1C1r3N1K3j441x2W1M/Vertical1.jpg
http://f.cl.ly/items/2g3T2m313B2b3p3H1K ... lfinal.jpg

Command Used is,

convert Horizantal1.jpg -bordercolor black -border 10%x10% Horizantalfinal
convert Vertical11.jpg -bordercolor black -border 10%x10% Verticalfinal
convert Square11.jpg -bordercolor black -border 10%x10% Squarelfinal


If you notice in all the three images there is difference,

In Horizontal Image, Sides has more border than the top and bottom.
In Vertical Image, Top and bottom has more border than the sides
and square also in the same way.

What i have to do to make all the sides of border look equal in all the three orientations?

and what is the standard percentage of border i have to take 10x10 or more/less?

Re: Adding Borders

Posted: 2013-06-24T13:12:00-07:00
by helloworld
I am trying to apply three different types of border to an image. The border format look like below,

http://f.cl.ly/items/0G1l3Z1c2A0w1r290C3I/keyline.png
http://f.cl.ly/items/1C1w07181g0a0B3X1z ... eyline.png
http://f.cl.ly/items/101d1p2x3v3R3C0b2e3q/gallery.png

My question is how can i apply such kind of borders to an image when it is varying according to image size?

Re: Adding Borders

Posted: 2013-06-24T13:23:56-07:00
by Bonzo
First thing I would do is check the OPTIONS page to see how to correctly write what I wanted to do.

Depends on the version you are using as well.

Re: Adding Borders

Posted: 2013-06-24T15:14:53-07:00
by fmw42
What i have to do to make all the sides of border look equal in all the three orientations?
Borders in percent are always measure relative to the image size. That is what percent means --- percent of width and percent of height.

As of IM 6.7.8-8, you can specify the same amount for both width and height based upon one or the other via either value-x % of width is added to left/right and to top/bottom or value-y % of height is added to top/bottom and to left/right.

The alternate is to just use pixels.

Please read the options page for -border at http://www.imagemagick.org/script/comma ... php#border

An alternate is to use -extent and specify the output size you want the borders to achieve after they have been added.

You can also specify different borders in width and height by using -splice.

see
http://www.imagemagick.org/Usage/crop/#splice

P.S. All these kind of questions should be addressed to the User's forum in the future.

Re: Adding Borders

Posted: 2013-06-24T15:24:42-07:00
by helloworld
Thanks a lot. it fixed my problem.

Re: Adding Borders

Posted: 2013-06-24T15:25:54-07:00
by helloworld
I am trying to apply two different types of border to an image. The border format look like below,
My question is how can i apply such kind of borders to an image when it is varying according to image size?

Re: Adding Borders

Posted: 2013-06-24T15:44:55-07:00
by fmw42
Please clarify your question. I do not see the relationship between the two borders other than one is thicker than the other. Your examples do not give enough information.

Note, you can chain the border options in the same command.

convert image -bordercolor black -border 20 -bordercolor white -border 1 result