# Pixel2Motion

> Agent skill that turns a raster logo into a smooth SVG and an animated HTML logo reveal

- Category: Agents & Automation / Agent Skills & Plugins
- Language: Python
- Licence: MIT
- Repository: https://github.com/nolangz/pixel2motion
- Website: https://nolangz.github.io/pixel2motion/
- Canonical page: https://ai-tldr.dev/tools/pixel2motion/

## In short

Pixel2Motion is an open-source Codex and Claude skill for logo animation. It sits in the Agent Skills & Plugins category of the Agents & Automation tools and is open-source, written in Python and licensed MIT. To get started: get the skill.

## Overview

Pixel2Motion is an open-source Codex and Claude skill for logo animation. Given a PNG, JPG, WebP or screenshot of a logo, the agent rebuilds it as a clean, minimal SVG and then choreographs that vector into a logo reveal delivered as a standalone, dependency-free HTML file, with GIF/video previews and motion QA evidence alongside. Its `SKILL.md` frames the work in three phases — Pixel (read the source and write a motion brief), Vector (fit geometry structured for motion) and Motion (author the animation using Disney's 12 principles of animation).

The vector phase follows a complexity ladder: primitives first, then primitive composites, few-curve analytic paths, smoothed outlines, and trace-derived paths only when simpler geometry fails. Smoothness is a hard gate — a high-IoU trace that stair-steps is rejected in favour of a lower-complexity smooth curve — while IoU against the source is computed every iteration as a diagnostic. Each candidate is rendered and overlaid on the raster, and the overlays are saved as evidence. The resulting SVG keeps one element per semantic part (mark, dot, wordmark, individual letters) with stable ids, so the animation can target each part.

The motion phase writes `motion.css` against those ids and wraps it in a showcase HTML page with replay, slow-motion and speed controls, plus small atomic motion studies such as hover, pulse and press. The animation must land exactly on the verified static vector (the skill calls this the Final Frame Contract), and Playwright-driven scripts capture deterministic frames and probe risky windows such as draw-on strokes and handoffs. The static fitting method is documented in a companion project, Pixel2SVG-HTML. The skill is written in Python and released under the MIT license.

## What it does

- Raster logo (PNG, JPG, WebP or screenshot) to minimal SVG, fitted lowest-complexity-first from primitives up to smoothed paths
- Smoothness as a hard acceptance gate, with IoU against the source tracked as a diagnostic rather than a fixed threshold
- Overlay evidence for every fitting iteration, plus a Bézier path audit for noisy handles, tangent jumps and stair-step runs
- Motion-ready SVG structure: one element per semantic part with stable ids, `pathLength="1"` on draw-on strokes
- Dependency-free showcase HTML with replay, slow motion, a speed slider and atomic motion studies
- Deterministic frame capture and motion-continuity probing through Playwright, plus a written `motion_spec.md` brief

## Getting started

Pixel2Motion is a skill folder (`SKILL.md`, `references/`, `scripts/`) that your agent follows; its helper scripts need Python 3.10+, Pillow, numpy, Chrome or Chromium, and Playwright. The README does not document a one-line skill installer, so get the repository and set up the helpers locally.

1. Get the skill

   Clone the repository; the agent reads `SKILL.md` and the reference files before fitting or choreographing.

```bash
git clone https://github.com/nolangz/pixel2motion.git
```

2. Set up the helper environment

   The README's recommended local setup installs the image-analysis libraries and a Chromium build for Playwright. If Chrome is not on the default path, set `CHROME_BIN` before running render checks.

```bash
python3 -m venv .venv
.venv/bin/pip install pillow numpy playwright
.venv/bin/python -m playwright install chromium
```

3. Fit and check the static vector

   After writing the motion brief in `motion_spec.md`, render the candidate SVG over the source logo and record the fit metrics. Run `scripts/svg_path_audit.py` too when curve smoothness is a concern.

```bash
python3 scripts/render_overlay.py logo.svg source.png \
  --out outputs/fit_iterations/01_overlay.png \
  --render-out outputs/final_render.png \
  --report outputs/fit_metrics.json
```

4. Build the showcase HTML

   Combine the verified SVG with the authored choreography in `motion.css`.

```bash
python3 scripts/animate_svg_showcase.py logo.svg \
  --css motion.css \
  --out logo_motion.html \
  --title "Logo Motion" \
  --duration-hint 1500
```

5. Capture motion QA frames

   Render deterministic frames at chosen times and compare the last one with the static render, so the animation provably ends on the verified vector.

```bash
python3 scripts/capture_motion_frames.py logo_motion.html \
  --times 0,300,700,1000,1250,1500 \
  --out outputs/motion_frames \
  --strip outputs/motion_strip.png \
  --compare-final outputs/final_render.png
```

## When to use it

- Reach for it when a brand only has a PNG or screenshot of its logo and needs a clean, editable SVG version
- Reach for it to build a splash-screen intro, header reveal, loading loop or hover micro-interaction for a logo
- Reach for it when an animated logo has to ship as plain HTML/CSS with no animation library, plus GIF or video previews for review
- Reach for it when you want reviewable evidence — overlays, metrics and frame strips — that an AI-made vector and animation match the original
