Contrek: Vectorizing 10 Billion Pixels on a Raspberry Pi 5 with Just 4 GB RAM
Description and use
Contrek enables processing of 10 billion‑pixel raster images on a Raspberry Pi 5 with 4 GB RAM by streaming horizontal stripes and writing polygons to disk, keeping peak memory below 2.42 GB.
Problem
Processing extremely large raster images without loading the entire image into memory.
Outcome
On a Raspberry Pi 5 with 4 GB RAM, Contrek processed a 10 billion‑pixel image in 13 min 52 s, peaking at 2.42 GiB memory, producing a 21.03 GB SVG without any swap.
Workflow
- 1. Install Contrek on a Raspberry Pi 5 with 4 GB RAM, 250 GB NVMe SSD, Ubuntu 24.04 ARM64 Docker container.
- 2. Prepare a 100,000 × 100,000 pixel PNG image (~900 MB compressed).
- 3. Run Contrek with horizontal stripe width of 1,000 rows.
- 4. Contrek extracts contours, reconnects across stripes, and writes polygons to disk progressively.
- 5. Monitor execution time, peak memory, and CPU usage.
- 6. Verify output SVG (~21 GB) and confirm no swap usage.
Evidence
Contrek can process an image in horizontal stripes, reconnecting contours across stripe boundaries and progressively writing completed polygons to disk.
The input was a 100,000 × 100,000 pixel PNG image, containing 10 billion pixels. The compressed PNG file is about 900 MB.
Peak process memory 2.42 GiB
Output SVG 21.03 GB
The process completed successfully, with zero swaps reported by GNU time.
- Record date: 2026-10-23T10:11:32.525Z