Iterated Function System fractal renderer — ported from 2019 with transform library, chaos game engine, and Ward tone mapping
Find a file
2026-07-01 20:35:46 +00:00
best Updated README and example images 2019-09-01 09:50:11 -04:00
tests Phase 6b: replace hand-rolled PNG writer with Pillow 2026-07-01 20:12:30 +00:00
.gitignore gitignore: modernize from 2019-vintage 5-line file 2026-07-01 20:22:09 +00:00
baseforms.py Phase 2: extract box_filter_colour as pure function 2026-07-01 20:02:29 +00:00
cli.py Phase 6a: new argparse CLI + bugfix tostring→tobytes 2026-07-01 20:10:20 +00:00
config.py Added Spherical Baseform and seed testing method 2019-09-03 23:00:57 -04:00
Handkerchief-MoebHorseshoe-InverseJulia_640203127151861639.png Updated README and example images 2019-09-01 09:50:11 -04:00
ifs.py Phase 3: refactor IFS — from_config factory + test core methods 2026-07-01 20:03:28 +00:00
image.py Phase 6b: replace hand-rolled PNG writer with Pillow 2026-07-01 20:12:30 +00:00
InverseJulia-Moebius-Moebius-InverseJulia_4523210280205849639_1000x1000.png Updated README and example images 2019-09-01 09:50:11 -04:00
LICENSE Updated README and LICENSE to reflect changes 2019-08-23 18:36:16 -04:00
MoebDiamond-Horseshoe-MoebDiamond_5586231712168643826.png Updated README and example images 2019-09-01 09:50:11 -04:00
MoebSwirl-MoebSwirl-MoebSwirl_1913761909573458553_1500x1500.png Updated README and example images 2019-09-01 09:50:11 -04:00
pyifs.py Phase 6c: pyifs.py thin wrapper + cleanup 2026-07-01 20:13:13 +00:00
pyproject.toml Phase 0-1a: scaffold project + test all 16 transforms 2026-07-01 20:00:46 +00:00
README.md Updated README and example images 2019-09-01 09:50:11 -04:00
REVIEW.md add turbocharging section: CLIP, lacunarity, Bayesian optimization, parameter-prediction path 2026-07-01 19:43:50 +00:00
transforms.py Ported to Python3, plus added quality checking prerender 2019-08-29 13:11:11 -04:00

Iterated Function System Renderer in Python

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.

Installing

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.

Running

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.

Customization

Parts of the code that can be customized are as follows:

  • You can adjust the width, height, iterations, num_points, num_transforms, moebius_chance, and image_count in the file config.py
  • You can write new Transform or ComplexTransform classes in transforms.py

Writing New Transforms

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.

Examples

example IFS 1 example IFS 2 example IFS 3 example IFS 4