ml_artists · KlingemannGlitch
Glitch (Mario Klingemann — glitch-print aesthetic)
Klingemann's practice amplifies the visible failure modes of digital pipelines — distorted faces mid-decode, colour-shifted artefacts, rectangular datamosh tears — into the subject matter itself. The kernel: build a multi-octave RGB noise substrate off-screen, then at each step apply a random affine warp (rotation + scale + shear + translate) and an RGB-cube rotation (3 independent planar rotations), alpha-blend the result onto the canvas, and occasionally paste a hard rectangular 'tear' band straight from the substrate. Each step is one glitch event; the canvas accumulates an ever-thicker shell of warped, colour-shifted, sliced noise.
Original: https://aiartists.org/mario-klingemann
▶ Try the live demo (JS port) ▶ Run reference.py via Pyodide 10 formulas have instant JS ports. The Pyodide path runs the actual Python in your browser — first load is ~6 MB, then instant.
Math essence
Substrate S ∈ [0,1]^{H×W×3}. Each step: pick affine M (rot+scale+shear), translation t; sample canvas coords back through M^{-1} into S with bilinear interpolation → warped W; rotate colour via random orthogonal R ∈ R^{3×3}; alpha-blend W·R over the canvas at opacity α; with probability p_slice also paste a horizontal or vertical hard band of S directly onto the canvas.
Parameters
| Name | Type | Default | Range | Description |
|---|---|---|---|---|
dim | int | 600 | 200–1500 | Square canvas side length (px). |
substrate_size | int | 512 | 64–2048 | Side length of off-screen noise substrate. |
glitch_prob | float | 0.85 | 0–1 | Per-step probability of a new glitch event. |
alpha | float | 0.55 | 0–1 | Blend opacity of each glitch event. |
max_warp | float | 0.35 | 0–1.5 | Max per-glitch rotation (rad) and scale jitter. |
colour_shift | float | 0.6 | 0–3.14 | Max RGB-cube planar rotation angle per glitch (rad). |
slice_prob | float | 0.4 | 0–1 | Per-glitch probability of drawing a hard tear slice. |
Reference
First 60 lines of reference.py. Full source:
library_external/ml_artists/KlingemannGlitch/reference.py
"""KlingemannGlitch — Mario Klingemann glitch-art kernel.
Mario Klingemann's practice has long embraced glitch and failure modes
as expressive surface: in the *Memories of Passersby* series the GAN
output is "occasionally struggling to proceed" and visibly distorts,
and across his glitch work he amplifies the artefacts of digital
processing into the subject matter itself. This is the algorithmic
backbone of that aesthetic, reduced to a numpy primitive:
1. Build a synthetic noise substrate (per-pixel RGB).
2. Apply a random affine warp (rotation + scale + shear + translate).
3. Apply a per-channel colour shift (random rotation in RGB space).
4. Alpha-blend the warped/shifted substrate over the canvas with
controllable transparency and edge-cut (rectangular slice
"tears" with hard horizontal/vertical seams).
5. Repeat — each step introduces a new glitch event.
The result is a slow accumulation of torn, colour-shifted, geometrically
warped noise patches on top of a black canvas, in the spirit of
Klingemann's glitch prints.
References:
- https://aiartists.org/mario-klingemann
- http://quasimondo.com/
- "Memories of Passersby I" — Sotheby's / Klingemann, 2018
"""
from __future__ import annotations
from typing import ClassVar
import numpy as np
def _bilinear_sample(img: np.ndarray, xs: np.ndarray, ys: np.ndarray) -> np.ndarray:
"""Sample img at fractional (xs, ys) with bilinear interpolation.
img: (H, W, C) float32. xs, ys: (H', W') float32 in [0, W-1]/[0, H-1].
Returns (H', W', C) float32, with edge-clamp.
"""
H, W, C = img.shape
x0 = np.floor(xs).astype(np.int32)
y0 = np.floor(ys).astype(np.int32)
x1 = x0 + 1
y1 = y0 + 1
x0 = np.clip(x0, 0, W - 1)
x1 = np.clip(x1, 0, W - 1)
y0 = np.clip(y0, 0, H - 1)
y1 = np.clip(y1, 0, H - 1)
fx = (xs - np.floor(xs)).astype(np.float32)
fy = (ys - np.floor(ys)).astype(np.float32)
fx = fx[..., None]
fy = fy[..., None]
Ia = img[y0, x0]
Ib = img[y0, x1]
Ic = img[y1, x0]
Id = img[y1, x1]
top = Ia * (1.0 - fx) + Ib * fx
bot = Ic * (1.0 - fx) + Id * fx
return top * (1.0 - fy) + bot * fy
Try running it locally
The reference implementation is self-contained Python with numpy. Install the package and run:
python library_external/ml_artists/KlingemannGlitch/reference.py Need help? See Learn for the standard environment setup, or Playground for an in-browser sketchbook.
More from ml artists
DeepDream Field (Mike Tyka — AI: DeepDream / Inceptionism)
ml_artists · TykaDeepDreamField
Inspired by Mike Tyka's AI: DeepDream series (2015-) and his co-authorship of 'Inceptionism: Going Deeper into Neural Networks' with Mordvintsev and Olah.
GAN Watercolor (Helena Sarin — Neural Bricolage / #latentDoodles)
ml_artists · SarinWatercolor
Inspired by Helena Sarin's Neural Bricolage practice (#latentDoodles, GAN Weaver, The Book of veGAN): she trains GANs on her own watercolor paintings and sketches, then curates the output back into analog paintings.
Memories of Passersby (Mario Klingemann — Memories of Passersby I)
ml_artists · KlingemannMemorex
Inspired by Mario Klingemann's Memories of Passersby I (2018, Sotheby's) — a custom GAN trained on 17th–19th-century portraits that runs forever, never repeats an output, and 'observes itself' in a feedback loop.
Neural Biodiversity (Sofia Crespo — Neural Zoo / Artificial Natural History)
ml_artists · CrespoNeuralBiodiversity
Inspired by Sofia Crespo's Neural Zoo (2018-), Artificial Natural History (2019-), and Beneath the Neural Waves (2021): she uses 3D GANs, CNN-based texture synthesis and 3D style transfer to fabricate a 'natural history book that never was' — chimerical creatures whose anatomies recombine fragments of real species.
Style Transfer Field (Gene Kogan — ml4a)
ml_artists · KoganStyleTransferField
Inspired by Gene Kogan's Experiments with Style Transfer and the ml4a curriculum: neural style transfer iteratively updates an image so its Gram-matrix feature statistics match a style reference — the gradient of the style loss with respect to pixels defines a vector field.