Fred's ImageMagick Scripts


    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:

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


Applies an irregular linear weave-like distortion to an image.

Download Script

last modified: November 24, 2023

USAGE: weave [-m modulation] [-d distortion] [-b blur] [-k kind] [-c compose] [-s size] [-o offset] [-a angle] [-o opacity] [-S seed] [-r retain] infile [tilefile] outfile
USAGE: weave [-h or -help]

-m .. modulation .. image modulate percent values; three comma separated
................... values for brightness,saturation,hue;
................... default="100,100,100" (no change)
-d .. distortion .. image distortion amount in pixels; two comma separated
................... values; default="7,7"
-b .. blur ........ distortion blur sigma amount; float>=0; default=4
-k .. kind ........ kind of distortion; options are random or image;
................... default="image"
-c .. compose ..... compose method; softlight, overlay, pegtoplight;
................... default=softlight
-s .. size ........ tile size in pixels defining outer rectangle;
................... default="9x9"
-o .. offset ...... tile offset to inner rectangle;
................... two "x" separated integers; default="2x2"
-a .. angle ....... angle of rotation for tile; 0<=integer<=180; default=45
-O .. opacity ..... tile opacity; 0<=integer<=100; default=100
-S .. seed ........ seed for kind=random; integer>=0; default=no seed
-r .. retain ...... retain image of tile as tile.png; yes or no; default=no

optional tilefile in place of tiling arguments

PURPOSE: To apply an irregular linear weave-like distortion to an image.

DESCRIPTION: WEAVE applies an irregular linear weave-like distortion to an image.


-m modulation ... image MODULATION percent values. Three comma separated values for brightness,saturation,hue. The default="100,100,100" (no change)

-d distortion ... image DISTORTION amount in pixels. Two comma separated values. The default="7,7".

-b blur ... distortion BLUR sigma amount. Values are floats>=0. The default=4.

-k kind ... KIND of distortion: Options are random (r) or image (i). The default="image".

-c compose ... COMPOSE method. Choices are: softlight (s), overlay (o), or pegtoplight (p). The default=softlight.

-s size ... tile SIZE in pixels defining outer rectangle. The default="9x9"

-o offset ... tile OFFSET to inner rectangle. Two "x" separated integers. The default="2x2"

-a angle ... Angle of rotation for tile. Values are 0<=integers<=180. The default=45

-O opacity ... tile OPACITY. Values are 0<=integers<=100. The default=100

-S seed ... SEED for kind=random. Values are integers>=0. The default=no seed

-r retain ... Retain image of tile as tile.png. Options are: yes (y) or no (n) The default=no

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.


Example 1 --- Variation of Compose Method


-m 90,70,100 -o 90 -k image -s 9x9 -o 2x2 -c softlight

-m 90,70,100 -o 90 -k image -s 9x9 -o 2x2 -c overlay

-m 90,70,100 -o 90 -k image -s 9x9 -o 2x2 -c pegtoplight

Example 2 --- Variation in Size


-m 90,70,100 -o 90 -k image -s 9x9 -o 2x2 -c softlight

-m 90,70,100 -o 90 -k image -s 6x6 -o 2x2 -c softlight

Example 3 --- Variation of Kind


-m 90,70,100 -o 90 -k image -s 9x9 -o 2x2 -c softlight

-m 90,70,100 -o 90 -k random -s 6x6 -o 2x2 -c softlight

What the script does is as follows:

  • Creates a tile from a line pattern
  • Tiles out an image to the size of the input times 1.414
  • Rotates the tiled image by 45 deg and center crops
    to the size of the input
  • Reads the input
  • Modulates the input
  • Copies the cropped tiled image to MPR: and
    adjusts its opacity
  • Composes the mpr: tiled image with the input
  • Blurs a grayscale clone of the composite image
  • Distorts the input using the blurred clone of the composite
  • Saves the output