---
name: before-after
description: Before / after comparison videos and stills from two images or two videos - an animated wipe slider, a static split, side by side, stacked for 9:16, or a toggle that cuts between them - with labels, a divider in the brand colour and a still compare PNG for posts. Use after an upscale, restoration, colour grade, restyle, retouch, background swap or any Kenerate edit when the user wants to show the difference, make a transformation reel, or post a before / after.
compatibility: Python 3.9+ with Pillow and ffmpeg. The Kenerate MCP server only for making the "after".
metadata:
  author: kenerate
  version: "1.1"
  kenerate-tools: "upscale_image upscale_video restyle_video apply_filter generate_image wait_for_generation"
---

# Before / after

`scripts/beforeafter.py` lines the two sides up pixel for pixel (no Ken Burns on stills) and renders the comparison
with ffmpeg. Rules: [references/KENERATE.md](references/KENERATE.md).

## Ask the user
The two sides (Kenerate urls or files), the mode (wipe for reels, stack for 9:16, split / side for posts, toggle for
punchy cuts), labels (default BEFORE / AFTER), accent colour, length for stills (default 6 s), and for videos whose
sound to keep (`--audio none|before|after`; none by default - don't add music unasked).

## Make the "after" (Kenerate, if needed)
`upscale_image` / `upscale_video` (estimate_cost first for video), `restyle_video`, `apply_filter`, or an edit with
`generate_image(reference_image_urls=[photo], model="kenerate/gpt-image-2.5-sunburst")` (see
[references/MODELS.md](references/MODELS.md)). Keep the same framing: the comparison only works if both sides line up.

## Render
```
python <skill-dir>/scripts/beforeafter.py --before "<original>" --after "<result>" --mode wipe --seconds 6 \
  --labels "ORIGINAL,KENERATE 4K" --accent "#FFD60A" [--aspect 9:16] [--font-family "Inter"]
```
Outputs: `compare.mp4`, `compare_still.png` (half / half or side by side, labelled) and `compare_preview.jpg`. Show
the preview; the script warns when the two sides have different shapes or lengths.

## Progress and output
Steps: fetch → prepare both sides → render (percent) → still + preview.

## If something fails
Misaligned sides (an outpainted or recropped "after"): crop both the same way first (`image-editing`), or use
`side` / `stack`, which don't need alignment.

## Limits
Videos use the shorter clip's length. Labels are Latin script.
