Page 1 of 1

borders on the inside

Posted: 2007-01-16T11:06:42-07:00
by xms
Hi guys and gals,

When i add borders to images, it places the border on the outside of the image thus increasing the images dimensions.

How can i add a border to the inside of the image, so that the image retains its previous dimensions but has a border overlayed around the edges of the image?

Cheers :)

Posted: 2007-01-16T20:31:50-07:00
by anthony
Draw, a rectangle with the right stroke width around your image.

Hmmm a rose is 70x46 pixels, so...

Code: Select all

   convert rose: -fill none -stroke navy -strokewidth 11  \
           -draw 'rectangle 0,0 69,45'   inside_border.jpg
the stroke width = {border width wanted} * 2 -1

EG: 1 -> stroke width of 1
6 -> stroke width of 11 (as above)

:P

I have no idea where this should be put in IM Examples!!!!

Posted: 2007-01-17T01:38:30-07:00
by xms
Thanks for that anthony - but what about if you don't know the size of the image?

Posted: 2007-01-17T04:46:29-07:00
by anthony
Then you will have you use -chop and -slice.. on the edges with gravity settings
Once on diagonally oppist corners will do the trick.

Code: Select all

convert rose: -background green -chop 6x6+0+0 -splice 6x6+0+0  \
                      -gravity SouthEast -chop 6x6+0+0 -splice 6x6+0+0 \
                     +gravity          inside_border_spliced.jpg
Addes to IM Examples misc -- will appear in a few hours there

Posted: 2007-01-17T04:49:17-07:00
by xms
You're a diamond :)

I do have one more question however (sorry). I'll post a new thread for it.