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

COLLAGE


Creates a multi-variant collage of the input image.

Download Script

last modified: September 26, 2017



USAGE: collage [-d dimensions] [-b bgcolor] [-m mode] [-n newseed] [-p pattern] [-s scale] [-g geometry] [-f format] [-r radius] [-t taper] infile [overlayfile] outfile
USAGE: collage [-h or -help]

-d ... dimensions ... WidthxHeight of output; if only one, then output will
..................... be square; if none, then output will be the size of
..................... the input; integers>0; default is size of input
-b ... bgcolor ...... background color; any valid opaque IM color is allowed;
..................... default is black
-m ... mode ......... mode is either all (18 variants) or half (9 variants)
..................... of the input image in the collage; default is all
-n ... newseed ...... seed value for the randomization of the variants;
..................... integer>0; default causes every output to be different;
..................... use of any other value will cause the output to be
..................... repeatable
-p ... pattern ...... pattern for the optional overlay image; choices are:
..................... 1, 2, 3 or 4; 1 is one copy in the middle or over the
..................... whole image based upon the scale value; 2 is a variant
..................... in the southeast and northwest corners; 3 is a variant
..................... in the southwest and northeast corners; 4 is a variant
..................... in all 4 corners of the output; default=1
-s ... scale ........ scale factor of the overlay image variants as a
..................... percent of the output image dimensions;
..................... 0<integer<=100; default=50
-g ... geometry ..... geometry offset in pixels for both x and y for
..................... overlay image variants; integer; default=0
-f ... format ....... preprocessing format for the overlay image; choices
..................... are: none, flip, flop, rot90, rot180, rot270;
..................... default=none
-r ... radius ....... radius of the vignette as a percent of half the image
..................... input image dimensions: 0<integer<=100; default=50
-t ... taper ........ taper rate of the vignette expressed as a sigma value;
..................... integer>0; default=10

PURPOSE: Creates a multi-variant collage of the input image.

DESCRIPTION: Creates a multi-variant collage of the input image. Choices are either 18 variants in the collage or 8 variants in the collage. Variants are randomized in position, orientation and scale. An optional overlay image may be added with 4 choices of number and positions of the variants added atop of the collaged input image.

ARGUMENTS:

-d dimensions ... DIMENSIONS are the WidthxHeight of output. If only one value is specified, then the output will be a square. If neither are provided, then the output will be the size of input. Values are integers>0. The default is the size of input.

-b bgcolor ... BGCOLOR is the background color for the output image. Any valid opaque IM color is allowed. The default is black.

-m mode ... MODE is either all (a) or half (h); all uses 18 variants of the input image in the collage. Half uses only 9 variants of the input image in the collage. The default is all.

-n newseed ... NEWSEED is the seed value for the randomization of the variants. Values are integers>0. The default causes every output to be different. Use of any other value will cause the output to be repeatable.

-p pattern ... PATTERN for the optional overlay image. The choices are: 1, 2, 3 or 4. 1 is one copy in the middle or over the whole output based upon the scale value. 2 is a variant in the southeast and northwest corners. 3 is a variant in the southwest and northeast corners. 4 is a variant in all 4 corners of the output. The default=1.

-s scale ... SCALE is the scale factor for the overlay image variants expressed a as a percent of the output image dimensions. Values are 0<integer<=100. The default=50.

-g geometry ... GEOMETRY offset in pixels for both x and y for the overlay image variants. Values are integers. The default=0.

-f format ... FORMAT is the preprocessing format for the overlay image. The choices are: none, flip, flop, rot90, rot180, rot270. The default=none.

-r radius ... RADIUS of the vignette expressed as a percent of half of the input image dimensions. Values are 0<integer<=100. The default=50.

-t taper ... TAPER rate of the vignette expressed as a (blur) sigma value. Values are integers>0. The default=10.

NOTE: The optional overlay image should be a mostly transparent image so that it does not cover too much of the collage.

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


Example 1 -- No Overlay Image

Original Image
(source)

Arguments:
-d 500x500 -b "#bcf8bb" -m all -n 1

 

Arguments:
-d 500x500 -b "#bcf8bb" -m all -n 100

 

Arguments:
-d 500x500 -b "#bcf8bb" -m half -n 300

 



Example 2 -- With Overlay Image

Original Image
(source)

Overlay Image
(source)

Arguments:
-d 500x500 -b "#bcf8bb" -m all -n 1 -p 1 -s 30 -g 0

 

Arguments:
-d 500x500 -b "#bcf8bb" -m all -n 1 -p 2 -s 30 -g 30

 

Arguments:
-d 500x500 -b "#bcf8bb" -m all -n 1 -p 3 -s 30 -g 30

 

Arguments:
-d 500x500 -b "#bcf8bb" -m all -n 1 -p 4 -s 30 -g 30

 



What the script does for m=all is as follows:

  • Makes 18 variations of the input image of the size of the desired output
    where each variant is has a randomize position, scale and orientation.
  • The variants are composited with various transparencies onto colored
    background image as they are created.
  • Optionally a transparent overlay image is made into up to 4 orientions and composited onto the result.

See the code for details