Page 1 of 1
Achieving this layout 2x2 but then with a layer on top in the middle
Posted: 2017-04-06T03:06:47-07:00
by henry_neves7
Hi there
I'm very new to ImageMagick so please excuse my ignorance.
I'm trying to achieve this layout:
https://www.dropbox.com/s/3p7ir297q2exq ... 2.png?dl=0
What I've got so far is this:
Code: Select all
convert \( image-1.png image-2.png -bordercolor white -border 20 +append \) \
\( image-3.png image-4.png -bordercolor white -border 20 +append \) \
\( image-5.png +append \) \
-bordercolor white -border 5 -gravity south -background white -append result.jpg
What I'm struggling with is the concept of getting the last appended image to position centrally, on top of the other images.
Any help would be great, thanks very much
Henry
Re: Achieving this layout 2x2 but then with a layer on top in the middle
Posted: 2017-04-06T03:24:30-07:00
by snibgo
Your code "+appends" 1 and 2, so they are side-by-side in one image. Then 3 and 4 likewise, in a second image.
middle wrote:\( image-5.png +append \)
That would put 5 next to anything else in that list. But there is nothing else, so "+append" does nothing. Now we have a third image.
Then you "-append" all three images vertically.
It would seem better to append just the first two images vertically. Then composite 5 over the result.
Like this (untested code):
Code: Select all
convert \
\( image-1.png image-2.png -bordercolor white -border 20 +append \) \
\( image-3.png image-4.png -bordercolor white -border 20 +append \) \
-bordercolor white -border 5 \
-append \
image-5.png
-gravity Center -compose Over -composite \
-background white result.jpg
Re: Achieving this layout 2x2 but then with a layer on top in the middle
Posted: 2017-04-06T03:50:25-07:00
by henry_neves7
Thank you so much!
This was the final code that got the desired output:
Code: Select all
convert \( image-1.png image-2.png -bordercolor white -border 20 +append \) \
\( image-3.png image-4.png -bordercolor white -border 20 +append \) \
\-append \
\image-5.png \
-gravity center -compose over -composite \
-background white result.jpg
Henry
Re: Achieving this layout 2x2 but then with a layer on top in the middle
Posted: 2017-04-06T04:32:54-07:00
by henry_neves7
Also, if I wanted to add a tiled image as a background to this, would I need to do a montage and then compose the rest over the top?
I've tried using -tile x1 but it's saying it can't open the file.
Thanks
Re: Achieving this layout 2x2 but then with a layer on top in the middle
Posted: 2017-04-06T04:45:26-07:00
by snibgo
First, use "-bordercolor none". This adds a border, but transparent.
Once you have made one image from the five images, you can composite that over your backgound image, like this:
Code: Select all
convert \
\( image-1.png image-2.png -bordercolor none -border 20 +append \) \
\( image-3.png image-4.png -bordercolor none -border 20 +append \) \
-append \
image-5.png \
-gravity center -compose over -composite \
background.png \
+swap \
-composite \
-background white result.jpg
I've used your version of the code, but removed the superfluous "\" from the start of "\image-5.png" and "\-append". They may be harmless, but seem confusing.
EDIT: I fouled up the first version.
Re: Achieving this layout 2x2 but then with a layer on top in the middle
Posted: 2017-04-06T04:53:59-07:00
by henry_neves7
Great!! That and making the border colour transparent has achieved the exact thing I wanted.
Thanks so much for your help
Re: Achieving this layout 2x2 but then with a layer on top in the middle
Posted: 2017-04-06T05:00:17-07:00
by snibgo
Oops, yes, I fouled up my own copy-paste. Sorry about that. As you say, the bordercolor needs to be "None".