How to borders on the inside ?

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
haloween
Posts: 2
Joined: 2019-03-18T21:01:38-07:00
Authentication code: 1152

How to borders on the inside ?

Post by haloween »

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 :)
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: How to borders on the inside ?

Post by fmw42 »

Please always provide your Imageamgick version and platform when asking questions, since syntax may differ. Also provide your command line if possible.

The the way to do what you want is to shave off the amount of pixels that you want to add as a border. So if you only want one pixel border, then

Code: Select all

convert image -shave 1x1 -bordercolor somecolor -border 1 result

For new users, see

http://www.imagemagick.org/discourse-se ... f=1&t=9620
http://www.imagemagick.org/script/comma ... essing.php
http://www.imagemagick.org/Usage/reference.html
http://www.imagemagick.org/Usage/
https://github.com/ImageMagick/usage-markdown
https://imagemagick.org/script/porting.php#cli
Post Reply