This program randomly generates IFS fractal images using the chaos game and linear tone mapping.
Initially written in Python 2 under the guidance of Thomas Ludwig one night at KiwiFoo. The tone-mapped image handling comes from Minilight. Restructuring, port to Python 3, and additional transforms by Jezza Hehn. Most of the additional transforms have been converted from Scott Draves' original paper on fractal flames.
NOTE: While this will run in standard Python 3, using PyPy3 will be about 40x faster.
You will need to install PyPy3, as well as the modules colour
, click
, numpy
, and zlib
using PyPy3's pip. Please see this page for further details.
Just run
pypy3 pyifs.py
NOTE: If you get a nice result, the random seed is saved as a large integer in the image filename. If you wish to re-render at a different resolution, pass this seed to the IFSI constructor instead of a new random integer.
Parts of the code that can be customized are as follows:
- You can adjust the
width
,height
,iterations
,num_points
,num_transforms
,moebius_chance
, andimage_count
in the fileconfig.py
- You can write new
Transform
orComplexTransform
classes intransforms.py
A new subclass of Transform
should randomize its parameters in __init__
then implement a transform
method that takes two args (the x, y of the point) and returns a new x, y.
Alternatively, you can subclass ComplexTransform
. Instead of implementing transform
, implement a method f
that takes a single complex number argument and returns a new complex number.