montage photos with soft, blurred transition

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
anchris

montage photos with soft, blurred transition

Post by anchris »

I often have to arrange photos in a row with soft transitions like in panoramaphotos. Until now I've done that in Gimp. But it's a very time-consuming task, so I wanted to do it script-based. Here is my first attempt (assuming pic1 and pic2 being 150x150px):
#! /bin/bash
convert -size 250x150 xc:yellow \
pic1.jpg \
-composite \
\( pic2.jpg \( \
\( -size 150x50 gradient:transparent-opaque -rotate -90 \) \
\( -size 100x150 xc:white \) \
+append \) \
-gravity East -compose CopyOpacity -composite \) \
-geometry +100+0 \
-composite \
out.png && feh out.png
Normally I have a set of images (with different sizes) in a directory that have to be appended. So it would be nice if my script could do this task automatically. For this taskt it's silly that I have to define the final image-size at the beginning. It would be much nicer if I just could tell montage to append the images with a blurred transition. But I didn't find a way to do that.

Thanks for help

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

Re: montage photos with soft, blurred transition

Post by fmw42 »

post a link to an example of each image and the result
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: montage photos with soft, blurred transition

Post by anthony »

Well it took me some time to go through old posts, from after my vacation, so I am sorry about the late reply.

Overlapping photos should be fairly straight forward, us a masked compose
http://imagemagick.org/Usage/compose/#mask

Code: Select all

convert -size 150x100 xc:white xc:black \
             -size 150x50 gradient: +swap -append -rotate 90 \
             pic1am8.jpg -extent 250x150 pic2dv0.jpg \
             \( -clone 0 \) -delete 0 -gravity East -composite \
            outdc7.png
The first two lines generates a gradient mask, black or one image, white for the other, with the right type of overlap.

The next line reads in the 'background' image, and enlarged (any color) so it is the same size as the mask, then the 'source' or overlay image is read in.
The images are reorderd into 'background', 'source', 'mask' and gravity set to place the source on the right hand size. Finally the images composed to
generate the gradient overlaped images.

Easy.

This is going in to IM Examples: Photo Modification, Cookbook.
http://imagemagick.org/Usage/photos/#overlap
and should appear in a day or so.

Other way is to mask the second image with transparency then, set it 'page' or virtual-canvas position (using -repage), and -mosaic, or -layer merge the two images together, which will automatically calculate the canvas size.
See http://imagemagick.org/Usage/layers/#mosaic
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply