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 a map-like folded appearance to an image.

Download Script

last modified: February 07, 2019

USAGE: picturefold [-n numfolds] [-a angle] [-h height] [-l location] [-y yoffset] [-s shading] [-t thickness] [-b bdcolor] [-B bgcolor] [-o opacity] [-d distance] [-r ramp] infile outfile
USAGE: picturefold [-help]

-n ... numfolds .... number of folds; integer>=2; default=5
-a ... angle ....... angle of fold; 0<=integer<=40; default=10
-h ... height ...... crop height as percent; 5<=integer<=95; default=95
-l ... location .... vertical crop location; north, south or center;
.................... default=center
-y ... yoffset ..... percent vertical offset from the crop location;
.................... -100<=integer<=100; default=0
-s ... shading ..... shading brightness value; 0<=integer<=100; default=70
-t ... thickness ... border thickness; integer>=0; default=0 (off)
-b ... bdcolor ..... border color; any valid IM color is allowed;
.................... default=red
-B ... bgcolor ..... background color; any valid IM color is allowed;
.................... default=white
-o ... opacity ..... shadow opacity; 0<=integer<=100; default=0 (off)
-d ... distance .... shadow distance; integer>=0; default=5
-r ... ramp ........ shadow ramping (tapering); integer>=0; default=5

PURPOSE: To apply a map-like folded appearance to an image.

DESCRIPTION: PICTUREFOLD applies a map-like folded appearance to an image. A border or shadow optionally may be placed around the image.


-n numfolds ... NUMFOLDS is the number of folds. Values are integers>=2. The default=5.

-a angle ... ANGLE of fold. Values are 0<=integer<=40. The default=10.

-h height ... HEIGHT is the crop height as percent of the image height for desired region. Values are 5<=integers<=95. The default=95.

-l location ... LOCATION is the desired vertical crop location. Values are: north, south or center. The default=center.

-y yoffset ... YOFFSET is the percent vertical offset from the crop location. Values are -100<=integer<=100. The default=0.

-s shading ... SHADING brightness value. Values are 0<=integer<=100. A value of 0 is black and 100 is full image brightness. The default=70.

-t thickness ... THICKNESS is the border thickness. Values are integers>=0. However, for thickness=1, thickness will be set to 2 for functionality reasons. The default=0 (no border).

-b bdcolor ... BDCOLOR is the border color. Any valid IM color is allowed. The default=red.

-B bgcolor ... BGCOLOR is the background color. Any valid IM color is allowed. The default=white.

-o opacity ... OPACITY is the shadow opacity. Values are 0<=integer<=100. The default=0 (no shadow).

-d distance ... DISTANCE is the shadow distance (length). Values are integers>=0. The default=5.

-r ramp ... RAMP is the shadow ramping (tapering). Values are integer>=0. The default=5.

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 Parameters

Original Image




-t 8


-o 80


-t 8 -o 80


-n 10 -t 8


-a 20 -t 8


-a 40 -t 8


-t 8 -h 60 -y -5

Example 2 - Variation Of Parameters

Original Image


-h 50


-t 8 -h 50


-o 80 -h 50


-t 8 -o 80 -h 50


-h 95

What the script does is as follows:

  • Crops the image as desired
  • Creates a vertically striped mask with alternating sections of
    bright and dark and multiplies it with the image
  • Creates a white on black mask with alternately sheared sections
    and puts it in the alpha channel of the image
  • Optionally adds a border
  • Optionally adds a shadow