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

JULIASET


Creates a julia set fractal image

Download Script

last modified: September 26, 2017



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

-d ... dimensions ... WxH of output; integers>0; default="400x400"
-c ... constant ..... fixed complex constant, c=(creal+i*cimag) used in
..................... the julia set expression; comma separate pair:
..................... "creal,cimag" where creal is the real part and
..................... cimag is the imaginary part; the absolute value of c,
..................... |c| = sqrt(realc^2 - imagc^2) <= 2; default="-0.7,0.27015"
-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 julia set fractal image.

DESCRIPTION: JULIASET creates a julia 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=(creal+i*cimag) is a fixed complex value. 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.

ARGUMENTS:

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

-c constant ... CONSTANT is the fixed complex constant in the julia set expression where c=(creal+i*cimag) is expressed as a comma separate pair: "creal,cimag". Here creal is the real part and cimag is the imaginary part. The absolute value of c, |c| = sqrt(realc^2 - imagc^2) <= 2. The default="-0.7,0.27015"

-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.

REFERENCES:
http://jonisalonen.com/2013/lets-draw-the-mandelbrot-set/
https://rosettacode.org/wiki/Julia_set
https://en.wikipedia.org/wiki/Mandelbrot_set
http://lodev.org/cgtutor/juliamandelbrot.html

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

Arguments:
-c -0.7,0.27015
(defaults)



Example 2 -- Default Settings And Move To New Middle

Arguments:
-c -0.7,0.27015 -m 193,114



Example 3 -- Default Settings And Move To New Middle And Zoom 10

Arguments:
-c -0.7,0.27015 -m 189,111 -z 10



Example 4 -- Default Settings And Move To New Middle And Zoom 100

Arguments:
-c -0.7,0.27015 -m 189,111 -z 100



Example 5 -- Different c

Arguments:
-c -0.8,0.156



Example 6 -- Different c

Arguments:
-c -0.4,0.6



Example 7 -- Different c

Arguments:
-c 0.285,0.01



Example 8 -- Different c

Arguments:
-c -0.835,0.2321



Example 9 -- Different c

Arguments:
-c -0.8,0.2