border around entire montage?

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
dcohen613
Posts: 2
Joined: 2016-02-08T14:31:33-07:00
Authentication code: 1151

border around entire montage?

Post by dcohen613 »

I have a montage that I want to put a border around. I don't want each image in the montage bordered, rather the entire finished product. I can do it in two commands, but ideally want it done in one.

Code: Select all

montage ( ( ( 1.jpg -auto-orient -geometry 408x264! ) ( border.png -auto-orient -geometry 408x264! ) -composite -quality 100 ) ( ( 2.jpg -auto-orient -geometry 408x264! ) ( border.png -auto-orient -geometry 408x264! ) -composite -quality 100 ) ( ( 3.jpg -auto-orient -geometry 408x264! ) ( border.png -auto-orient -geometry 408x264! ) -composite -quality 100 ) ( ( 1.jpg -auto-orient -geometry 408x264! ) ( border.png -auto-orient -geometry 408x264! ) -composite -quality 100 ) ( ( 2.jpg -auto-orient -geometry 408x264! ) ( border.png -auto-orient -geometry 408x264! ) -composite -quality 100 ) ( ( 3.jpg -auto-orient -geometry 408x264! ) ( border.png -auto-orient -geometry 408x264! ) -composite -quality 100 ) ( ( 1.jpg -auto-orient -geometry 408x264! ) ( border.png -auto-orient -geometry 408x264! ) -composite -quality 100 ) ( ( 2.jpg -auto-orient -geometry 408x264! ) ( border.png -auto-orient -geometry 408x264! ) -composite -quality 100 ) ) -tile 2x4 -geometry +0+0 -mode Concatenate output_montage.jpg
then

Code: Select all

convert output_montage.jpg -bordercolor white -border 10 finaloutput.jpg
How can I do this in one step?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: border around entire montage?

Post by snibgo »

I don't know montage, but the usual border commands seem to work, eg:

Code: Select all

montage rose: rose: -mode concatenate -gravity center -bordercolor Blue -border 20 x.png
EDIT: Oops, correction. The usual border commands give a border around each image, which isn't what you want.

Incidentally, "-quality" is needed only once, before you write the JPEG file.
snibgo's IM pages: im.snibgo.com
dcohen613
Posts: 2
Joined: 2016-02-08T14:31:33-07:00
Authentication code: 1151

Re: border around entire montage?

Post by dcohen613 »

Thanks for the reply. I don't understand the "rose: rose:" portion of it.

I know I overuse -quality and possibly other commands. Can you help show me using my current commands what I need to do?

Thank you so much
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: border around entire montage?

Post by fmw42 »

You could pipe the output of montage to convert to add the border. Use miff: for the output of montage and - for standard input to convert. That is the only way I know to do that.

Code: Select all

montage .... miff:- | convert - -bordercolor xxx -border y result.jpg
rose: (with the colon) is an internally stored IM image. See http://www.imagemagick.org/script/forma ... tin-images
Post Reply