Function Repository Resource:

RandomFractalArt

Source Notebook

Make a random fractal image based on the Mandelbrot set

Contributed by: Mark Greenberg

ResourceFunction["RandomFractalArt"][]

returns an image of part of the Mandelbrot set randomly stylized.

Details and Options

RandomFractalArt starts with a random location near the border of the Mandelbrot set and zooms in a random amount. Then it applies two of several mapping functions to produce different layers. Each layer is randomly colored and has a style applied to it. The layers are combined with one of several combining functions. The combined image then may have symmetry transformations applied and/or bump added.
Renders can take up to 30 seconds for the default image size and longer for larger image sizes. Be patient.
ResourceFunction["RandomFractalArt"] will produce some images that are not visually interesting. Try again. Persistence pays off after a few tries.
ResourceFunction["RandomFractalArt"] takes the following options:
"ColorNudge"0.offsets the hue of each layer (except layers with built-in color schemes)
"CompileList"{}a list of the mapping functions that should be freshly compiled
"ComplexNudge"0. + 0. ioffsets the fractal’s center
"ImageSize"{210,210}sets the size of the final image
"IncludeRandomSeed"Falseassigns a random seed useful for reproducing an image
"OutputType""Image"determines the kind of output
"ZoomNudge"0.offsets the zoom level
The CompileList option contains a list of the mapping functions that should be freshly compiled. The default value is an empty list, which means that ResourceFunction["RandomFractalArt"] will use precompiled versions of all mapping functions. Include a mapping function in this list if you have altered the mapping function's code. Mapping functions in this list will be compiled for the target system of the current device.
The ImageSize option requires values in one of these forms:
{w,h}a list of two integers for width and height
na single integer equivalent to {n,n}
Tiny{105, 105}
Small{210, 210}
Medium{420, 420}
Large{840, 840}
The value assigned to the "IncludeRandomSeed" option should have one of these forms:
Truea random integer from 1 to a trillion, which is reported in the dataset output, seeds the random generator, allowing the image to be reproduced
Falseno random seeding is done so the final image cannot be reproduced by RandomFractalArt
nan integer to serve as the random seed
stra string to serve as the random seed
If the option "OutputType" is set to "Dataset", then instead of the fractal art image, the output of RandomFractalArt will be a dataset containing these items:
"image size"the size of the image
"random seed"random seed used, if any
"fractal's corner"the upper left corner of the image as a complex number
"fractal's center"the center of the image as a complex number
"complex nudge"the optional offset amount applied to the fractal's location
"zoom nudge"the optional offset amount applied to the zoom level
"color nudge"the optional amount the hue was shifted
"layer 1 zoom level"the zoom factor of the first layer
"layer 1 color function"the color function of the first layer
"layer 1 mapping function"the mapping function used in the first layer
"layer 1 original"the image of the first layer without any style applied
"layer 1 style"the style applied to the first layer
"layer 1 with style"the image of the first layer with style applied
"layer 2…"the same data items for the second layer
"blending operation"the function used to combine the two layers
"blended image"the result of combining the two layers
"symmetry applied"what symmetry was applied, if any
"image with symmetry"the blended image with symmetry applied
"bump applied"the source of the bump map, if any
"image with bump"the final output of RandomFractalArt
The "ComplexNudge" option takes a complex number. Small changes can make a great difference as many parameters are sensitive to the fractal’s center and corner coordinates. If you want fine control with this option, note the "fractal’s corner" data given in the dataset output option.
The "ZoomNudge" option takes a real number. Positive numbers zoom further in revealing more detail. Negative number zoom out.
The "ColorNudge" option only effects layer 1 and only when layer 1's color is not one of the built-in color schemes. "ColorNudge" takes a real number that offsets h in Hue[h,s,b] for each pixel. As hue is cyclical, only the fractional part of a value will make a difference.
The zoom levels of layer 1 and layer 2 only differ when the layers share the same mapping function.
The information in the dataset output is useful for tweaking the final fractal image, but it may not be sufficient for recreating it.
Images in the dataset output are twice the linear size of the final output. This allows for a smoother final render.

Examples

Basic Examples (1) 

Create a fractal image:

In[1]:=
ResourceFunction["RandomFractalArt"][]
Out[1]=

Scope (1) 

The more times you run the function, the better your chances of producing results that you find interesting:

In[2]:=
Table[ResourceFunction["RandomFractalArt"][ImageSize -> Tiny], 6]
In[3]:=
(* Evaluate this cell to get the example input *) CloudGet["https://www.wolframcloud.com/obj/09619840-ec98-47d6-a351-864dc9ed49c8"]

Options (7) 

ImageSize (1) 

Often interesting details come out in larger images. The ImageSize option sets the size of the image:

In[4]:=
Table[ResourceFunction["RandomFractalArt"][ImageSize -> s], {s, 100, 475, 125}]
Out[4]=

IncludeRandomSeed (1) 

By including a random seed, you can experiment at a smaller size and then rerender the same fractal at a larger size:

In[5]:=
ResourceFunction["RandomFractalArt"][IncludeRandomSeed -> "maths", ImageSize -> Tiny]
In[6]:=
ResourceFunction["RandomFractalArt"][IncludeRandomSeed -> "maths", ImageSize -> Medium]

ComplexNudge (1) 

The "ComplexNudge" option allows you to offset the fractal's center horizontally (real) and vertically (imaginary):

In[7]:=
Row[Table[
  Image[ResourceFunction["RandomFractalArt"][IncludeRandomSeed -> 16, ComplexNudge -> cn], Magnification -> 1], {cn, -.01, .01, .01}], Spacer[8]]
Out[7]=

ZoomNudge (1) 

The "ZoomNudge" option allows you to offset the fractal's zoom level:

In[8]:=
Row[Table[
  Image[ResourceFunction["RandomFractalArt"][IncludeRandomSeed -> 27, ZoomNudge -> zn], Magnification -> 1], {zn, -40, 40, 40}], Spacer[8]]
Out[8]=

ColorNudge (1) 

The "ColorNudge" option allows you to offset the hue of any layers that do not use the built-in color schemes. This option has no effect when both layers use built-in colors schemes:

In[9]:=
Row[Table[
  Image[ResourceFunction["RandomFractalArt"][IncludeRandomSeed -> 41, ColorNudge -> cn], Magnification -> 1], {cn, -.2, .2, .2}], Spacer[8]]
Out[9]=

OutputType (1) 

By setting the "OutputType" option to "Dataset", you can get details about how the fractal was put together:

In[10]:=
ResourceFunction["RandomFractalArt"][IncludeRandomSeed -> "Waltham", OutputType -> "Dataset"]
Out[10]=

CompileList (1) 

The "CompileList" option allows you to freshly compile any of the mapping functions. The string names in the list may include any of the following: "Beanstalks", "Cobweb", "DandelionSeeds", "Decomposition", "Filigree", "Foliage", "LineOrbitTrap", "ModTrailings", "ParallelogramOrbitTrap", "RibsAndTusks", "Smooth", "ThreePointsOrbitTrap". Compiling a fresh version of a mapping function can take a minute or more:

In[11]:=
Row[Table[
  AbsoluteTiming[
   Image[ResourceFunction["RandomFractalArt"][
     IncludeRandomSeed -> "Example", CompileList -> cl], Magnification -> 1]], {cl, {{}, {"Beanstalks", "Decomposition"}}}]]
Out[11]=

Applications (1) 

Make a unique banner background:

In[12]:=
ResourceFunction["RandomFractalArt"][ImageSize -> {800, 200}]
Out[12]=

Properties and Relations (1) 

While RandomFractalArt is for serendipitous discovery, the resource function MandlebrotSetRemap gives you control over how the image develops:

In[13]:=
ResourceFunction["MandelbrotSetRemap"][.385 - .27 I, 105, MaxIterations -> 54]
Out[13]=

Neat Examples (1) 

It is fun to see what your own fractal looks like (based on your name). Try different variations of your name as the random seed, for instance "Joanne Smith", "Joanne A. Smith", "Joanne Alexi Smith", etc.:

In[14]:=
ResourceFunction["RandomFractalArt"][
 IncludeRandomSeed -> "Joanne Alexi Smith", "ImageSize" -> Medium]

Publisher

Mark Greenberg

Requirements

Wolfram Language 13.0 (December 2021) or above

Version History

  • 1.1.0 – 17 April 2023
  • 1.0.0 – 15 March 2023

Related Resources

Author Notes

License Information