Talk to me · Julian Reder · Resume · GitHub

fractalgen

Solo Projects · 2026

A fractal and dynamical-systems wallpaper engine with 129 built-in looks, an interactive browser editor, and TOML recipes that render cleanly up to 16K.

PythonNumPyNumbaSciPyPillowPreactTOML
fractalgen schematic
The local browser editor with julia_dragon open. Palette, framing, layer, and effect tweaks update the preview live.

Built

fractalgen started as two messy wallpaper scripts I got tired of copying every time I wanted a new desktop background. I rebuilt it into a Python engine driven by TOML recipes: each recipe picks a registered generator, parameters, a palette, framing, tone curve, composited layers, and post-processing effects. Heavy inner loops compile with Numba across CPU cores, and a local browser editor lets me pan, zoom, and tune a look before exporting it at full resolution.

Hard parts

  • A 960 px preview and a 16K export have to produce the same composition, so framing, aspect-ratio rules, and size-dependent effects (blurs, glows) are defined relative to a fixed 4K reference canvas.
  • Auto-exposing from the current frame's histogram made panning shift the brightness whenever brighter regions scrolled in or out. Tone statistics are now measured once on the recipe's authored view and replayed for every other view.
  • Points inside a fractal never escape and used to run all the way to the iteration limit. Adding Brent cycle detection to the Numba kernels stops as soon as an orbit repeats.
  • Full renders can take seconds, so the editor caches intermediate iteration and density buffers and reuses them whenever only the palette, tone curve, or post-processing changes.

Learned

Separating what an image is (a TOML recipe) from how pixels are computed (a generator plugin) made variations, recipe inheritance, plugins, and embedded-recipe exports all fall out of the same data model.

Also

  • 129 built-in looks across escape-time fractals, Buddhabrots, Newton basins, Lyapunov space, domain coloring, fractal flames, strange attractors, IFS, reaction-diffusion, slime mold, sandpiles, hyperbolic tilings, harmonographs, and caustics.
  • Zero-build Preact and htm browser editor (fractalgen gui) with drag/scroll pan, zoom, rotate, undo history, random variations, hold-backslash before/after compare, and 2x/3x supersampled export.
  • Composited text, shape, and image layers (blend modes, glows, bevels, shadows) feeding an ordered post-processing chain.
  • Every exported PNG or JPEG embeds its full TOML recipe in image metadata, so any wallpaper can be forked straight back into an editable look.
  • Plugin hooks for generators, palettes, formulas, maps, flows, and effects in Python or TOML via package entry points.
  • Batch presets for desktops, phones, ultrawides, and multi-monitor setups, backed by unit tests, image parity checks, and a Playwright GUI suite.

From hardcoded scripts to recipes

fractalgen started as two scripts I wrote to generate desktop wallpapers for myself. Every fractal formula, color ramp, and crop lived directly in Python, so adding a new image meant duplicating a function and editing constants. I rebuilt it around two pieces: generators (registered functions that turn a region of the plane into field data) and recipes (TOML tables that pick a generator and describe everything else about the picture).

Recipes can extend other recipes, carry separate portrait framing for phones, and stack composited layers and effects, so most new looks take a few lines of TOML. The same recipe drives the CLI (fractalgen render, including --random), multi-device batch presets, and the browser GUI. Version 0.1.0 went up on GitHub in November 2026 under the MIT license.

Making the math fast enough to explore

An 8K wallpaper has over 33 million pixels, and several looks iterate each pixel more than a thousand times. The inner loops are compiled with Numba and run in parallel across cores. Escape-time kernels use Brent cycle detection so interior points that settle into repeating orbits stop early instead of hitting the iteration cap. Simulations like Gray-Scott reaction-diffusion and physarum slime mold run on multi-threaded solvers, and batch renders run in isolated worker processes with timeouts so one slow look cannot stall a preset.

Interactive editing has its own speed constraint, since nobody wants to wait five seconds just to preview another palette. The server stores expensive intermediate buffers (iteration counts, density grids) in a bounded LRU cache and applies palettes, tone curves, and post-processing afterward, so recoloring or adjusting bloom updates quickly.

Same picture at 960 px and 16K

A look framed in a 960 pixel preview window should match the 16K export. Views are defined against a 4K reference canvas with explicit fill, cover, and contain rules for other aspect ratios, and pixel-radius effects like blur and bloom scale proportionally with the output dimensions.

Exposure needed the same fix. Generators that stretch dynamic range to fit the current frame's histogram re-exposed the image every time I panned, dimming bright filaments whenever something brighter scrolled into the corner. fractalgen now measures those tone statistics once on the recipe's authored view and replays them while panning and zooming, keeping colors anchored to the math rather than the current viewport.

The browser editor

Running fractalgen gui starts a local server and opens an editor written with Preact and htm as plain ES modules, with no Node build step or bundler. You can browse all 129 looks, generate parameter variations, drag and scroll to pan, zoom, and rotate, tweak palettes, layers, and effects with full undo history, and hold backslash to compare against the original preset.

Exports support 2x and 3x supersampling, and every PNG or JPEG stores its full recipe in the file metadata. You can take any finished wallpaper and fork it straight back into an editable TOML file.