Files
ai-resume/tools/images
Sam Rolfe 6900101506 docs: image brief and treatment tooling
- docs/image-brief.md: one treatment for every image, keyed to the site palette
- tools/images/treat.py: cutout (rembg) and treat (Pillow) as separate, re-runnable steps
- tools/images/README.md: how to run it without polluting the NixOS python
2026-10-29 13:31:20 +11:00
..

Image treatment

Implements docs/image-brief.md. Two steps, in this order.

1. Cut the subject out

Needs rembg. It is not installed on the host, and installing Python packages on NixOS into the system interpreter is a bad idea. Use a container:

docker run --rm -v "$PWD/raw:/in" -v "$PWD/build/cut:/out" \
  -v "$PWD/tools/images/treat.py:/treat.py" \
  python:3.12-slim sh -c "pip install -q rembg[cpu] pillow onnxruntime && \
  python /treat.py cutout /in/*.jpg --out /out"

Or cut out by hand in GIMP and skip to step 2. For fewer than ten images, hand-cutting is usually better — automatic segmentation struggles with reflective or thin edges.

2. Apply the treatment

pip install pillow        # or the same container, without rembg
python3 tools/images/treat.py treat build/cut/*.png --size hero

Output lands in content/assets/images/ as WebP at quality 82, canvas #0b0d10, subject right of centre, left-to-right fade, rim glow from the alpha channel.

Then

  1. Add the page reference: ![caption](../../assets/images/name.webp)
  2. File the original in the project's own repo under docs/images/, with a note in that folder's README.md saying where it came from.
  3. Deploy and check it on the live site at 1440×900 and on a phone.