I am trying to achieve several things here with PHP an ImageMagick. Im new to ImageMagick and while I have been reading over all the documentation, I can't seem to work this out. What I'd like to achieve is bringing in up to 5 robot images onto a 1400x500 canvas. Each robot already has its own background color. I use {$robot_img_2} -transparent '#{$hex_bg2}'
to remove the robot background, and this is working well. Then what I'd like to do is bring each robot in at the center 'south' position and the move it left or right accordingly, having each robot overlapping just a little. Then I need to add a text caption at the top. However, when I bring the robots in they just line up end to end with no overlap (making the image too wide) and the text also gets lined up horizontally too. Not really sure how I'd achieve this. Here this the code I have and two image examples of what in getting, and what I want. I know my code is way off here. Any help would be appreciated.
$banner = exec("convert {$robot_img_1} -transparent '#{$hex1}' -resize 350x350 -gravity south \
{$robot_img_2} -transparent '#{$hex_bg2}' -resize 350x350 -gravity south -geometry +400+0 \
{$robot_img_3} -transparent '#{$hex_bg3}' -resize 350x350 -gravity south -geometry +800+0 \
{$robot_img_4} -transparent '#{$hex_bg4}' -resize 350x350 -gravity south -geometry -400+0 \
{$robot_img_5} -transparent '#{$hex_bg5}' -resize 350x350 -gravity south -geometry -600+0 \
\( -size 1400x500 xc:none \
-font 'signpainter-2.ttf' -gravity north -pointsize 88 -fill 'white' -annotate +0+0 'Hello World' -trim +repage \) {$background_type} {$output}");
Here is one way to do that in Imagemagick 6 in Unix Syntax.
color1=$( convert robot1.png -format "%[pixel:u.p{1,1}]" info: )
color2=$( convert robot2.png -format "%[pixel:u.p{1,1}]" info: )
color3=$( convert robot3.png -format "%[pixel:u.p{1,1}]" info: )
color4=$( convert robot4.png -format "%[pixel:u.p{1,1}]" info: )
color5=$( convert robot5.png -format "%[pixel:u.p{1,1}]" info: )
convert \
\( robot1.png -transparent "$color1" -resize 350x350 \) \
\( robot2.png -transparent "$color2" -resize 350x350 \) \
\( robot3.png -transparent "$color3" -resize 350x350 \) \
\( robot4.png -transparent "$color4" -resize 350x350 \) \
\( robot5.png -transparent "$color5" -resize 350x350 \) \
-background "#FAE500" +smush -50 \
\( -size 1500x100 -background "#FAE500" -fill white -font candice \
-gravity center label:"This Is The Title" \) \
+swap -smush 0 \
robot_results.png
See
https://imagemagick.org/script/command-line-options.php#smush