This is a Python implementation of the Flames Fractals algorithm.
The Fractal Flame algorithm is a two-dimensional Iterated Function System (IFS) that creates images by plotting the output of an attractor on the image plane. This algorithm is distinguished by its use of non-linear functions, log-density display, and structural coloring, which together result in a wide range of visually interesting images.
To use this implementation, clone the repository and follow the instructions in the README.md file within the repository.
To generate an image, use the GenerateImages.py
script.
It will generate the following image:
The code creates an ImageHolder
object of type Sierpinskies
.
Parameters are:
i
: the index of the imagen_im
: the total number of images - useful for videosize
: the size in pixels of the image to savename
: the name of the folder and basename for the image
The best way is to start from a simple existing ImageHolder
, such as Sierpinski
that creates a red-white Sierpinski triangle. One just needs to implement the create_variation
function.
At the core of this function, a Variation
object is created, taking as parameters:
- a
list
ofFunction
objects - an int
burn_steps
or number of times that the iterative functions are called but the results are not stored. 10-15 is usually a good default. a lower number can mean more blurry images. - an int
iterate_steps
that is the number of iterations that are stored, a higher number means more computing time but brighter images / more converged images. - an int
N
that is the number of points on which the functions are appliediterate_steps
times. A higher number means brighter images / more converged images. This parameter has the most impact on generating time. 15000 is a good default value for experimenting, that can be gradually increased.
Image | Description |
---|---|
![]() |
Image with N=15k points |
![]() |
Image with N=150k points |
![]() |
Image with N=1.5M points |
To generate a video, use the VideoGenerator.py
file, that contains the VideoGenerator
object. That object takes an ImageHolder
child class as argument.
- Document the
Function
parameters