Overlaying a picture on a collage/montage (with mogrify)

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

Re: Overlaying a picture on a collage/montage (with mogrify)

Post by fmw42 »

Use -background to set the background color in montage and then use -bordercolor to do the extra border needed to make the outside border the same as the inside borders.

montage -background black zelda3b.jpg zelda3b.jpg zelda3b.jpg \
zelda3b.jpg zelda3b.jpg zelda3b.jpg \
zelda3b.jpg zelda3b.jpg zelda3b.jpg \
-tile 3x3 -geometry +7+7 miff:- | \
convert - -bordercolor black -border 7 zelda_montage2.jpg

The pipe

miff:- | convert - -bordercolor black -border 7

is needed as you cannot mix convert commands within a montage. So you pipe the output from montage (miff:- | ) to convert - and then add the extra border around the outside to make the outside border the same as all the rest.
ShekarKCB

Re: Overlaying a picture on a collage/montage (with mogrify)

Post by ShekarKCB »

Hi,

This works Great... I modified little and i can get what i want. A collage from 9 images.
Image

Code used was

Code: Select all

echo -e "useing 'montage to convert the images...'"
 montage image-0.jpg image-1.jpg image-2.jpg image-3.jpg image-4.jpg image-5.jpg image-6.jpg image-7.jpg image-8.jpg -tile 3x3 -geometry +7+7 -background white miff:- |  convert - -bordercolor white -border 7 output_montage.jpg;

OP=`identify output_montage.jpg | awk '{print $3}'`;
echo -e "output_montage.jpg is Created with |$OP| size....Resizing image to 315x320..\n";
convert output_montage.jpg -resize 315x320 -quality 100 output_montage_1.jpg;
OP=`identify output_montage_1.jpg | awk '{print $3}'`;
echo -e "output_montage_1.jpg is Created with |$OP| size....adding border 0x40 in order to make 315x320..\n";
convert output_montage_1.jpg -bordercolor black -border 0x40 -quality 100 output_montage_2.jpg;
Thanks for the help. Is there any way to tilt the image to the behind or right side using convert/mogrify/montage?
From photoshop i created this image is there any to do the same using convert/mogrify?
Image

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

Re: Overlaying a picture on a collage/montage (with mogrify)

Post by Bonzo »

I have an example of most of the operators here: http://www.rubblewebs.co.uk/imagemagick/operator.php
They are written using php but you should be able to convert it to how you are running your code.

You want to use distort and depending on your version the use changed for the specification of the corners.
Image

Code: Select all

<?php 
$cmd = "$input -matte -virtual-pixel transparent ".
"-distort Perspective \"0,0 0,0  0,200 0,200 266,200 ".
"266,180 266,0 266,20 \" ";
exec("convert $cmd virtual_pixel.png"); 
?> 
ShekarKCB

Re: Overlaying a picture on a collage/montage (with mogrify)

Post by ShekarKCB »

Hi,

I got the example. But could you tell me what are those numbers used? is it a,b,c,d sides? or how does it represented?
Basically what those numbers say ? (0,0 0,200, ...etc)

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

Re: Overlaying a picture on a collage/montage (with mogrify)

Post by Bonzo »

Check out Anthony's examples: http://www.imagemagick.org/Usage/distorts/#perspective

From memory it was "top left old" "top left new" "bottom left old" "bottom left new" etc. and it is now "top left old" "bottom left old" "bottom right old" "top right old" "top left new" "bottom left new" etc.

Depending on your version; I can not remember when it changed possibly around 6.3.5 ? If one method does not work try the other.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Overlaying a picture on a collage/montage (with mogrify)

Post by fmw42 »

I think it changed at 6.3.6.0
ShekarKCB

Re: Overlaying a picture on a collage/montage (with mogrify)

Post by ShekarKCB »

Hi,

Issue resolved. Used gimp to find the required co-ordinates. Great help Thanks Once again.

Thanks
Post Reply