Skip to content
Projects
Personal·design

Interactive Icon

Automated Avatar Compositing

Computer VisionPythonToolingGitHub
We had hundreds of character images that needed to become avatar icons — consistently framed, shaped, and composited onto styled backgrounds. Doing this manually in Photoshop would take forever. So I built a pipeline.
Interactive Icon runs a 5-stage compositing process: portal layer (generates the shaped background using SVG templates), character layer (loads the image and detects head position), auto-framing (computes optimal scale and position to center the head within the portal shape), mask clipping (applies SVG masking via CairoSVG), and compositing with downscale.
The auto-framing algorithm is the interesting part. It uses head bounding boxes to compute a scale factor and offset that centers the character naturally — not just geometrically centered, but visually balanced based on where the head sits relative to the shoulders.
The tool supports batch processing and has a Gradio web UI for one-off experimentation. Built with Python, Pillow for image manipulation, and CairoSVG for vector rendering.