Hello everyone,
ifs-fractals — a small library and CLI that draws the attractors of iterated function systems (the Barnsley fern and friends) with the chaos game — just got its first feature release since arriving on opam this summer. After sixteen years of intensive development ![]()
What’s new in 1.1.0:
- Headless PNG rendering. Until now the fractals could only be drawn into a graphics window. You can now render straight to a file, no display needed:
ifs-fractals -o fern.png -s 800x1280 barnsley
- or from code, save_png barnsley 200000 “fern.png”. This makes the package usable on servers and in CI, and made testing much easier. A fun constraint I set myself: no new dependencies — the PNG writer is self-contained, writing 8-bit PNGs with stored deflate blocks in pure OCaml.
- Density coloring. The chaos game doesn’t visit the attractor uniformly — some regions are hit far more often than others, and that density is where much of the visual structure lives. With -c (or save_png ~color:true), pixels are colored by their hit count on a log scale. The image above is the result: the fern gets its veins back.
ifs-fractals -c -o fern.png -s 800x1280 barnsley
Install or upgrade with opam install ifs-fractals, then try ifs-fractals --list to see all sixteen attractors.
If you’re curious how new attractors get designed — how one finds the six coefficients per affine map that produce a maple leaf or a sunflower — I wrote the techniques up in a short paper, Building New IFS Attractors: a Working Vocabulary of Affine Maps ( Building New IFS Attractors: a Working Vocabulary of Affine Maps | Zenodo ), with a more narrative account on my blog ( Cédric Bonhomme | Challenging Claude's creativity with IFS fractals and OCaml ).
One disclosure, since it’s the interesting part of the story: the new attractors were designed by Claude (Anthropic’s Fable 5 model) — the blog post recounts that experiment. Everything else — the library, the CLI, the PNG writer, and the paper itself — is my own work, not LLM output.
- Repository: GitHub - cedricbonhomme/iterated-function-systems: Iterated Function Systems fractals with OCaml. · GitHub
- opam: opam - ifs-fractals
- Changelog: iterated-function-systems/CHANGES.md at master · cedricbonhomme/iterated-function-systems · GitHub
Feedback and new fractal definitions are very welcome. Just make a pull-request.
If you design an attractor you like, I’d love to see it!
