Asymetric border

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
Flaver-D
Posts: 19
Joined: 2015-05-21T12:27:39-07:00
Authentication code: 6789

Asymetric border

Post by Flaver-D »

Hi!
I'm trying to take a bunch of images, resize them to 425x283 and then add a black asymmetric border to them to make the final images 450x413 with the image in the center of the final image.

So far, using the Mogrify -thumbnails 425x283 does a good job getting them to size. But I really don't know how to get a border around them that's +25+130 ... Using the -border function won't work because it's symmetrical... unless I crop the image after... I really don't know

Thanks
François
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Asymetric border

Post by Bonzo »

You could try adding -background white -gravity center -extent 450x413 to your command

You should be able to do it with the border command see: https://www.imagemagick.org/script/comm ... php#border
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Asymetric border

Post by fmw42 »

In addition to Bonzos suggestion (which is likely the best)

You can composite the image into a constant size black background with mogrify. See http://www.imagemagick.org/Usage/basics ... fy_compose. Probably use over rather than dst_in. See the -gravity to center.

Alternately, you can use multiple splice commands to add some amount to each of the four sides. See http://www.imagemagick.org/Usage/crop/#splice
Flaver-D
Posts: 19
Joined: 2015-05-21T12:27:39-07:00
Authentication code: 6789

Re: Asymetric border

Post by Flaver-D »

Well... that was fast and easy!
Thanks a million.... somehow I just kept taking the hard route...

Now, I'm off to step two, putting them into a grid using the montage function :D
François
Post Reply