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.


Creates a mandelbrot set fractal image

Download Script

last modified: December 15, 2018

USAGE: mandelbrot [-d dimensions] [-z zoom] [-m middle] [-C colors] outfile
USAGE: mandelbrot [-h or -help]

-d ... dimensions ... WxH of output; integers>0; default="400x400"
-z ... zoom ......... zoom value; float>0; default=1 (nominal size);
..................... larger values zoom in and smaller values zoom out
-m ... middle ....... middle (center) location for pattern; mx,my; comma
..................... separate pair of integers within the output image;
..................... default is W/2,H/2
-C ... colors ....... list of colors to make up the color map; at least two
..................... colors must be provided; the first color will be used
..................... as the background color; default="white blueviolet
..................... blue cyan green1 yellow orange red"

PURPOSE: To create a mandelbrot fractal image.

DESCRIPTION: MANDELBROT creates a mandelbrot set fractal image. The fractal is defined in the complex plane by iterating the expression, z^2 + c, where z=(x+i*y), i=sqrt(-1) and c is a complex value that varies with x and y. The fractal may be zoomed in at any center coordinate within the WxH. The output image is colored by a color map according to the number of iterations needed to converge at each pixel. The background color (first color in the list) represents reaching the maximum number of iterations, which is 255. Otherwise, smaller number correspond more to the left in the color map and larger colors correspond to more to the right in the color map.


-d dimensions ... DIMENSIONS are the width and height of the output image expressed as WxH. Values are integers>0. The default="400x400".

-z zoom ... ZOOM value. Values are floats>0. The default=1 (nominal size). Larger values zoom in and smaller values zoom out.

-m middle ... MIDDLE (center) location for the fractal pattern expressed as comma separated pair of integers, cx,cy, within the WxH. The default is W/2,H/2.

-C colors ... COLORS is the list of space delimited colors that makes up the horizontal 1D color map. At least two colors must be provided. The default="white blueviolet blue cyan green1 yellow orange red". Any valid IM (opaque) colors are allowed. The colors will be interpolated to form a 1024x1 color lookup table image applied via -clut.

NOTE: this script may be slow due to having to iterate up to 255 times at each pixels. Time run from a couple of seconds up to about 15 seconds for for a 400x400 sized image. The larger the zoom, the slower it will be.


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 -- Default Settings


Example 2 -- Move To New Middle

-m 189,111

Example 3 -- Move To New Middle and Zoom 10

-m 189,111 -z 10

Example 4 -- Move To New Middle and Zoom 100

-m 189,111 -z 100