How ackermanngue/go-painter works
go-painter is a CLI that turns a PNG or JPEG into a deterministic, layered brush-stroke painting. The user selects an input, preset, seed, and worker count; the CLI loads the image and invokes the painter, which prepares image structure, places strokes across brush-size passes, renders them onto a canvas, and saves a PNG. The README documents the principal stages and presets. Some implementation files were not sampled, so links for those stages follow documented responsibilities and uncertain internal calls are omitted.
Main entry points: painter.go Painter pipeline · main.go Painter CLI · load.go Image loading · rows.go Row workers
Components 19
CLI workflow
- Painter CLI
cmd/painter/main.go - Image loading
internal/imageutil/load.go - Style presets
internal/painter/presets.go - PNG saving
internal/imageutil/save.go
Image analysis
- Gaussian blur
internal/imageutil/blur.go - Grayscale conversion
internal/gradient/grayscale.go - Sobel gradients
internal/gradient/sobel.go
Stroke painting
- Painter pipeline
internal/painter/painter.go - Region error
internal/painter/error.go - Stroke generation
internal/painter/strokes.go - Canvas setup
internal/render/canvas.go
Rendering support
- Brush rendering
internal/render/brush.go - Alpha blending
internal/render/blend.go - Color sampling
internal/imageutil/color.go - Row workers
internal/parallel/rows.go - Image and stroke data
internal/model/types.go
Other components
- User
- Source image
- Painting PNG
Connections 20
- User → Painter CLI: sets options
- Painter CLI → Style presets: selects preset
- Painter CLI → Image loading: loads input
- Source image → Image loading: image data
- Painter CLI → Painter pipeline: paints image
- Image loading → Painter pipeline: provides image
- Painter pipeline → Gaussian blur: smooths source
- Painter pipeline → Grayscale conversion: converts intensity
- Painter pipeline → Sobel gradients: computes gradients
- Painter pipeline → Region error: measures regions
- Painter pipeline → Stroke generation: generates marks
- Stroke generation → Color sampling: samples color
- Painter pipeline → Canvas setup: initializes canvas
- Painter pipeline → Brush rendering: renders strokes
- Brush rendering → Alpha blending: blends pixels
- Gaussian blur → Row workers: dispatches rows
- Grayscale conversion → Row workers: dispatches rows
- Sobel gradients → Row workers: dispatches rows
- Painter pipeline → PNG saving: saves result
- PNG saving → Painting PNG: writes PNG