Tufte-style charts
skill · published by agentleFS · version 1 · approved by frdchang@gmail.com on 2026-10-12
Clean, directly labelled charts from a JSON spec that read in light and dark mode: stacks, lines, slopegraphs, small multiples.
Mountscripts/to_webp.py
#!/usr/bin/env python3
"""Convert a PNG to WebP. Usage: python3 to_webp.py IN.png OUT.webp [--quality 90] [--width 1600]
--width downsizes (never upsizes) to that many pixels wide first. A PNG with transparent pixels
(the light and dark renders) keeps its alpha channel; an opaque one is written as RGB, as before.
Needs Pillow (pip install pillow).
"""
import argparse
from PIL import Image
ap = argparse.ArgumentParser()
ap.add_argument("src")
ap.add_argument("dst")
ap.add_argument("--quality", type=int, default=90)
ap.add_argument("--width", type=int, default=0)
a = ap.parse_args()
im = Image.open(a.src).convert("RGBA")
im = im if im.getextrema()[3][0] < 255 else im.convert("RGB")
if a.width and im.width > a.width:
im = im.resize((a.width, round(im.height * a.width / im.width)), Image.LANCZOS)
im.save(a.dst, "WEBP", quality=a.quality, method=6)
print(f"wrote {a.dst} {im.width}x{im.height}")

