Fred's ImageMagick Scripts



    Licensing:

    Copyright © Fred Weinhaus

    My scripts are available free of charge for non-commercial (non-profit) 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

    Please read the Pointers For Use on my home page to properly install and customize my scripts.

HEXAGONS


Creates a hexagonal grid of the randomly rotated input image.

Download Script

last modified: December 15, 2018



USAGE: hexagons [-d dimension] [-c cellsize] [-e edgecolor] [-t thickness] infile outfile
USAGE: hexagons [-h or -help]

-d ... dimension .... square size of the output image; default is the
..................... minimum dimension of the input
-c ... cellsize ..... square size of hexagon cellsize; pixels or percent with
..................... % symbol included; default is 1/3 of dimension; the
..................... minumum size is the equivalent of 50 pixels and the
..................... maximum size is dimension (100%)
-e ... edgecolor .... edge color assigned to border of hexagons; any valid
..................... IM color is allowed; default is no edge color
-t ... thickness .... thickness of edges in pixels; integer>=0; default=0

PURPOSE: To create a hexagonal grid of the randomly rotated input image.

DESCRIPTION: HEXAGONS creates a hexagonal grid of scaled and randomly rotated copies of the input image. The input image will be center cropped to its minimum dimension for use in the hexagons.

ARGUMENTS:

-d dimension ... DIMENSION is the square size of the output image. The default is the minimum dimension of the input.

-c cellsize ... CELLSIZE is the square size of the hexagon cells. Units are either pixels or percent with % symbol included. The default is 1/3 of the dimension value. The minumum allowed size is the equivalent of 50 pixels and the maximum size is the dimension argument (i.e. 100%).

-e edgecolor ... EDGECOLOR is the color assigned to edges (border) of the hexagons. Any valid IM color is allowed. The default is no edge color.

-t thickness ... THICKNESS of edges in pixels. Values are integers>=0. The default=0 (no edge color).

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


Examples

Original
(source)

Arguments:
(defaults)

Arguments:
-c blue -t 2



What the script does is as follows:

  • Creates a hexagonal grid of the desired cell size tiled out
    to the output size as an array of hexagons
  • Creates a random set of rotation angles
  • Scales the input image sqrt(2) times the desired cell size
  • Creates a hexagonal mask of the desired cell size
  • Creates randomly rotated copies of the scaled image
    and assigns page offsets according to the hexagonal grid spacing
  • Flattens all the rotated, scaled and offset copies