[object Object]

← back to Wallco Ai

clean-edge upscale (#53677): confirm potrace vectorize beats LANCZOS, document venv invocation

f460ec85c3a35514f408ad693885620fb6b262fc · 2026-05-27 17:22:32 -0700 · Steve

potrace 5400px: 3 colors / 0.000% ramp (crisp). LANCZOS: 111029 colors / 7.816% ramp (blurry).
Add USAGE/ENV note for the cairosvg venv + DYLD_FALLBACK_LIBRARY_PATH gotcha.

Files touched

Diff

commit f460ec85c3a35514f408ad693885620fb6b262fc
Author: Steve <steve@designerwallcoverings.com>
Date:   Wed May 27 17:22:32 2026 -0700

    clean-edge upscale (#53677): confirm potrace vectorize beats LANCZOS, document venv invocation
    
    potrace 5400px: 3 colors / 0.000% ramp (crisp). LANCZOS: 111029 colors / 7.816% ramp (blurry).
    Add USAGE/ENV note for the cairosvg venv + DYLD_FALLBACK_LIBRARY_PATH gotcha.
---
 scripts/vectorize/vectorize.py | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/scripts/vectorize/vectorize.py b/scripts/vectorize/vectorize.py
index 6d7346f..0639612 100644
--- a/scripts/vectorize/vectorize.py
+++ b/scripts/vectorize/vectorize.py
@@ -20,6 +20,29 @@ Vector edges are resolution-independent, so the stair-step is gone for good
 Usage:
   vectorize.py SRC.png OUT.png [--inks N] [--target 5400]
                [--turdsize T] [--alphamax A] [--keep-aa] [--svg OUT.svg]
+
+ENV / INVOCATION (gotcha — system python3 has NO cairosvg):
+  This script needs `cairosvg`, which is NOT in system python3. A ready venv
+  lives at scripts/vectorize/.venv (cairosvg + pillow + numpy). cairosvg
+  dlopens libcairo at runtime, so point DYLD at homebrew's lib:
+
+    DYLD_FALLBACK_LIBRARY_PATH=/opt/homebrew/lib \
+      scripts/vectorize/.venv/bin/python scripts/vectorize/vectorize.py \
+      data/generated/<src>.png data/generated/clean_<id>_$(date +%s%3N).png \
+      --inks 4 --target 5400 --turdsize 2 --alphamax 1.0
+
+  To (re)build the venv:
+    python3 -m venv scripts/vectorize/.venv
+    scripts/vectorize/.venv/bin/pip install cairosvg pillow numpy
+
+  Defaults turdsize=2 alphamax=1.0 are PINNED — only nudge if a trace is
+  visibly degenerate. Always writes a NEW clean_<id>_<ts>.png; never
+  overwrites the source. NOT wired into the publish flow — standalone tool.
+
+Why potrace, not LANCZOS (measured on design #53677, 2026-05-27):
+  potrace 3 inks -> 5400px = 3 colors / 0.000% gradient-ramp (crisp edges);
+  LANCZOS same source = 111,029 colors / 7.816% ramp (blurry, violates
+  solid-screen-print). Vector edges are resolution-independent.
 """
 import argparse, subprocess, sys, tempfile, os, re
 from pathlib import Path

← e5f92ce render 5400px/150-DPI TIF archives for 25 HOT geom tiles (fr  ·  back to Wallco Ai  ·  designs.json refresh: allowlist svg-% generators + ship 11 n 6eda7cc →