An Iterated Function System in Python
MIT License
Initially written under the guidance of Thomas Ludwig one night at KiwiFoo.
The tone-mapped image handling comes from Minilight.
NOTE: I strongly recommend using PyPy to run this (it runs about 40x faster)
Just run
python pyifs.py
You can change the output filename at the bottom of pyifs.py
NOTE: You may want to provide a seed with random.seed()
so if you get a
nice result, you can re-run it at higher resolution, etc.
Parts of the code that can be customized are marked CUSTOMIZE
in pyifs.py
WIDTH
, HEIGHT
, ITERATIONS
, NUM_POINTS
andNUM_TRANSFORMS
Transform
classesTRANSFORM_CHOICES
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
and instead of implementing
transform
instead implement a method f
that takes a single complex number
argument and returns anew complex number.