Fred's ImageMagick Scripts



    Licensing:

    Copyright © Fred Weinhaus

    My scripts are available free of charge for non-commercial use, ONLY.

    For use of my scripts in commercial (for-profit) environments or non-free applications, please contact me (Fred Weinhaus) for licensing arrangements. My email address is fmw at alink dot net.

    If you: 1) redistribute, 2) incorporate any of these scripts into other free applications or 3) reprogram them in another scripting language, then you must contact me for permission, especially if the result might be used in a commercial or for-profit environment.

    Usage, whether stated or not in the script, is restricted to the above licensing arrangements. It is also subject, in a subordinate manner, to the ImageMagick license, which can be found at: http://www.imagemagick.org/script/license.php

ADJOIN


Appends multiple images together with positional justification.

Download Script

last modified: October 09, 2014



USAGE: adjoin [-m mode] [-g gravity] [-b bgcolor] infile1 ... infileN outfile
USAGE: adjoin [-h or -help]

-m .... mode ......... append mode: horizontal (or H) or vertical (or V)
-g .... gravity ...... gravity justification; default=H
...................... for mode=H, options are: north, center, south;
...................... for mode=V, options are: east, center, west;
...................... default=center
-b .... bgcolor ...... background color for fill areas; default=black

PURPOSE: To append multiple images together with positional justification.

DESCRIPTION: ADJOIN appends multiple images together with positional justification. Images may be appended either horizontally or vertically. For horizontal appending, position justification may be north (or top), center or south (or bottom). For vertical appending, position justification may be east (or right), center or west (or left). Any valid IM color including none (for transparent) may be used for fill areas.

ARGUMENTS:

-m mode ... MODE is the direction for appending. Choices are either horizontal (or H) or vertical (or V). If horizontal, the images will be appended in sequence from left to right. If vertical, the images will be appended in sequence from top to bottom. The default=horizontal.

-g gravity ... GRAVITY identifies the desired positional justification when appending. For mode=horizontal, positional justification may be north (or top), center or south (or bottom). For mode=vertical, positional justification may be east (or right), center or west (or left). The default=center.

-b bgcolor ... BGCOLOR specifies the background color to use for the fill areas. Any valid IM color specification may be used. To make the background transparent, set the color to none. The default is black.

IMPORTANT: This script may only work for IM 6.4.6-6 or higher due to a bug fix in -extent at that release.

CAVEAT: No guarantee that this script will work on all platforms, nor that trapping of inconsistent parameters is complete and foolproof. Use At Your Own Risk.


EXAMPLES


Horizontal Appending

Image 1

Image 2

Image 3

Arguments:
-m horizontal -g north -b black

Arguments:
-m horizontal -g center -b black

Arguments:
-m horizontal -g south -b black



Vertical Appending

Image 1

Image 2

Image 3

Arguments:
-m vertical -g west -b black

Arguments:
-m vertical -g center -b black

Arguments:
-m vertical -g east -b black



What the script does is as follows:

  • Finds the largest dimension (either vertically or horizontally) from all images
  • Pads each image to fill out that dimension
  • Appends all the filled out images

This is equivalent to the following IM commands for
the case of horizontal append:

  • convert $infilelist -gravity $gravity -background $bgcolor -extent x${maxh} +append $outfile