[magick-users] Composite or montage command to stack images
Anthony Thyssen
A.Thyssen at griffith.edu.au
Mon Jan 19 17:36:33 PST 2009
On Mon, 19 Jan 2009 23:03:03 +0700
magick-users-bounces at imagemagick.org wrote:
| On Mon, Jan 19, 2009 at 10:16 PM, elliott-brennan
| <elliottbrennan at gmail.com> wrote:
| > Hi all,
| >
| > I've trying to pull together a command to create
| > the following image:
| >
| > Three images stacked vertically on the left and
| > one image taking up the right hand side of the
| > frame. The right hand image would take up the
| > whole right hand half of the total image.
| >
| > I can't quite get it with -gravity (e.g.
| > NorthWest, West, SouthWest and East) as I keep
| > getting four images in each corner.
| >
| > Should I be creating images each with transparent
| > borders the size of the areas where the other
| > images are meant to go and then creating a montage
| > somehow?
| >
| > Could someone please point me in the correct
| > direction for this?
|
| Here is a script I have used to build a montage using convert:
| <script>
| #!/bin/sh
| # comp_l.sh - compose landscape pics
|
| convert -size 3000x2400 xc:white \
| dscn0556.png -geometry +10+10 -composite \
| dscn0560.png -geometry +801+10 -composite \
| dscn0561.png -geometry +1592+10 -composite \
| dscn0568.png -geometry +10+607 -composite \
| dscn0573.png -geometry +801+607 -composite \
| dscn0577.png -geometry +1592+607 -composite \
| dscn0581.png -geometry +10+1204 -composite \
| dscn0582.png -geometry +801+1204 -composite \
| dscn0583.png -geometry +1592+1204 -composite \
| dscn0584.png -geometry +10+1801 -composite \
| dscn0588.png -geometry +801+1801 -composite \
| dscn0589.png -geometry +1592+1801 -composite \
| landscapes.png
|
| exit 0
| </script>
|
| This makes no use of -gravity at all because I have pre-calculated all
| positions.
| Note than when using -gravity any position data you give it works
| toward the inside of the picture.
|
As you are only outputing an array in absolute coordinates
you maybe be able to automatically generate positions better
by using a pipeline type script.
See Layering Examples...
http://www.imagemagick.org/Usage/layers/#example
Though memory wise the above may be better as only one extra
image is in memory at any one time.
ASIDE: the equivelent 'layer' example is...
(Note layer flattening/merging automatically
generate a canvas of the current background color.
convert -page 3000x2400 \
-page +10+10 dscn0556.png \
-page +801+10 dscn0560.png \
-page +1592+10 dscn0561.png \
-page +10+607 dscn0568.png \
-page +801+607 dscn0573.png \
-page +1592+607 dscn0577.png \
-page +10+1204 dscn0581.png \
-page +801+1204 dscn0582.png \
-page +1592+1204 dscn0583.png \
-page +10+1801 dscn0584.png \
-page +801+1801 dscn0588.png \
-page +1592+1801 dscn0589.png \
-background white -flatten landscapes.png
NOTE: -page only sets a position for any image read/created after that
setting.
OR here is the -repage equivelent...
convert \
\( dscn0556.png -repage +10+10 \) \
\( dscn0560.png -repage +801+10 \) \
\( dscn0561.png -repage +1592+10 \) \
\( dscn0568.png -repage +10+607 \) \
\( dscn0573.png -repage +801+607 \) \
\( dscn0577.png -repage +1592+607 \) \
\( dscn0581.png -repage +10+1204 \) \
\( dscn0582.png -repage +801+1204 \) \
\( dscn0583.png -repage +1592+1204 \) \
\( dscn0584.png -repage +10+1801 \) \
\( dscn0588.png -repage +801+1801 \) \
\( dscn0589.png -repage +1592+1801 \) \
-repage 3000x2400 -background white -flatten \
landscapes.png
NOTE: The parenthesis limits the -repage position to just the image read
in while inside parenthesis.
Your choice as to which technique is used.
See the whole section on
Layers of Multiple Images
http://www.imagemagick.org/Usage/layers/
Anthony Thyssen ( System Programmer ) <A.Thyssen at griffith.edu.au>
-----------------------------------------------------------------------------
Computers are dumb... Unless otherwise stated!
-- Anthony Thyssen
-----------------------------------------------------------------------------
Anthony's Home is his Castle http://www.cit.gu.edu.au/~anthony/
More information about the Magick-users
mailing list