How to add a scratch-off reveal with Claude

A gold coin zigzags across a silver scratch card over the bottle, scraping the foil away row by row until a yellow "40% OFF" prize shows underneath.

Get this effect

  1. Switch to Code in your Claude Desktop App

  2. Install the skill (once)

    Show the prompt
    Install the Recharm video effects skill: download https://recharm-growth-staging.s3.us-east-2.amazonaws.com/website/downloads/recharm-video-effects.zip and unzip it into ~/.claude/skills
  3. Ask for the effect

    Add a scratch-off reveal to input.mp4
    Prize, subline: 40% OFF, TODAY ONLY
    Foil text: SCRATCH TO REVEAL

Several videos, several effects, one ask

Put your clips in the folder, mention them with @, and ask for everything at once. Claude runs one tested script after another on each clip, then joins them.

Add a scratch-off reveal to @clip1.mp4, put a sale badge on @clip2.mp4, give @clip3.mp4 a VHS look, then join all three with crossfades.

Settings you can change

Ask Claude to change any of these, or edit them at the top of the script.

SettingDefaultWhat it does
PRIZE, SUBLINE40% OFF, TODAY ONLYWhat the card reveals under the foil.
FOIL_TEXTSCRATCH TO REVEALPrinted on the silver foil.
START, END0.6, 2.4Seconds the coin scratches from and to.
HIDE4.5Second the card starts its 0.3-second fade out.
CARD_W, CARD_H0.80, 0.26Card size as shares of the frame width and height.
Y0.58Card center, 0-1 down the frame.
PRIZE_COLOR(255, 214, 0)Card color under the foil.
TEXT_COLOR(215, 25, 40)Prize text color.

Without the skill

Don’t want to install the skill? Paste this prompt into Claude Code and Claude writes the script itself.

Show the prompt
Add a scratch-off card to input.mp4. Draw a card 80% of the frame width by 26% of the frame height, centered across and with its center 58% down the frame, rounded corners (radius 10% of the card height) and a soft drop shadow. Under the foil the card is yellow (255, 214, 0) with "40% OFF" in bold red (215, 25, 40) text 36% of the card height tall, centered at 44% down the card, and "TODAY ONLY" in dark red (120, 20, 25) 12% of the card height tall at 76% down. Over it lay brushed silver foil (gray around 150-210 with a diagonal sheen and fine grain) printed with "SCRATCH TO REVEAL" in gray (95, 95, 102), 13% of the card height tall, centered. From 0.6 to 2.4 seconds a gold (196, 160, 84) coin, radius 12% of the card height, moves at a steady speed in a zigzag over four rows (15%, 38%, 62% and 85% down the card, left to right then right to left), and wherever it passes the foil is scratched away in a stroke 32% of the card height wide with slightly ragged edges. Any foil left fades out from 2.4 to 2.65 seconds, the full yellow card holds, and the whole card fades out from 4.5 to 4.8 seconds so the rest of the video is untouched. Use Python with Pillow and numpy to draw the card each frame and ffmpeg to put it on the video (don't rely on ffmpeg's drawtext filter), keep the audio, and save it as output.mp4.

Run it without Claude

This is the exact script we tested. Save it as scratch-off-reveal.py and run:

python3 scratch-off-reveal.py input.mp4 output.mp4
Show the script
#!/usr/bin/env python3
"""Scratch-off reveal: a coin scratches the silver foil off a card to uncover a yellow "40% OFF" prize.

Usage: python3 scratch-off-reveal.py input.mp4 output.mp4
Needs ffmpeg, Pillow and numpy (pip install pillow numpy).
"""
import json
import math
import subprocess
import sys
from pathlib import Path

import numpy as np
from PIL import Image, ImageChops, ImageDraw, ImageFilter, ImageFont

PRIZE, SUBLINE = "40% OFF", "TODAY ONLY"  # what the card reveals
FOIL_TEXT = "SCRATCH TO REVEAL"           # printed on the silver foil
START, END = 0.6, 2.4                     # seconds the coin scratches from and to
HIDE = 4.5                                # second the card starts to fade away (0.3s fade)
CARD_W, CARD_H = 0.80, 0.26               # card size as shares of the frame width and height
Y = 0.58                                  # card center, 0-1 down the frame
PRIZE_COLOR = (255, 214, 0)               # card under the foil
TEXT_COLOR = (215, 25, 40)                # prize text
FONTS = ["/System/Library/Fonts/Supplemental/Arial Bold.ttf",     # macOS
         "/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf",  # Linux
         "C:/Windows/Fonts/arialbd.ttf"]                          # Windows
FONT_FILE = next((f for f in FONTS if Path(f).exists()), None) or sys.exit("No bold font found: add one to FONTS")


def rounded(size, radius):
    m = Image.new("L", size)
    ImageDraw.Draw(m).rounded_rectangle([0, 0, size[0] - 1, size[1] - 1], radius, fill=255)
    return m


def prize_layer():
    img = Image.new("RGBA", (cw, ch), PRIZE_COLOR + (255,))
    draw = ImageDraw.Draw(img)
    draw.text((cw / 2, ch * 0.44), PRIZE, font=ImageFont.truetype(FONT_FILE, round(ch * 0.36)), anchor="mm", fill=TEXT_COLOR)
    draw.text((cw / 2, ch * 0.76), SUBLINE, font=ImageFont.truetype(FONT_FILE, round(ch * 0.12)), anchor="mm", fill=(120, 20, 25))
    return img


def foil_layer():
    """Brushed silver: a vertical gradient, a diagonal sheen and fine grain."""
    y, x = np.mgrid[0:ch, 0:cw].astype(np.float32)
    shade = 175 + 30 * np.cos(y / ch * math.pi * 1.6) + 28 * np.exp(-((x - y * 1.4 - cw * 0.35) / (cw * 0.12)) ** 2)
    shade += np.random.default_rng(1).normal(0, 6, (ch, cw))
    rgb = np.clip(np.stack([shade, shade, shade + 6], axis=2), 0, 255).astype(np.uint8)
    img = Image.fromarray(rgb).convert("RGBA")
    ImageDraw.Draw(img).text((cw / 2, ch / 2), FOIL_TEXT, font=ImageFont.truetype(FONT_FILE, round(ch * 0.13)),
                             anchor="mm", fill=(95, 95, 102))
    return img


def coin_path():
    """A zigzag over the card, left-right then right-left, row by row, as dense points."""
    pts, margin = [], brush * 0.6
    rows = np.linspace(0.15, 0.85, 4) * ch
    for i, ry in enumerate(rows):
        xs = np.linspace(margin, cw - margin, 120)
        for x in xs if i % 2 == 0 else xs[::-1]:
            pts.append((x, ry + brush * 0.25 * math.sin(x / cw * 9 + i)))
    return pts


def scratched_to(t):
    """Grow the scratched mask up to time t (frames arrive in order, so it only ever adds)."""
    global drawn
    p = min(max((t - START) / (END - START), 0), 1)
    upto = round(p * len(path))
    draw = ImageDraw.Draw(scratched)
    for x, y in path[drawn:upto]:
        r = brush * rng.uniform(0.85, 1.0)
        draw.ellipse([x - r, y - r, x + r, y + r], fill=255)
    drawn = max(drawn, upto)
    return path[upto - 1] if 0 < upto < len(path) else None


def overlay(t):
    img = Image.new("RGBA", (w, h))
    coin = scratched_to(t)
    if t >= HIDE + 0.3:
        return img
    leftover = 1 - min(max((t - END) / 0.25, 0), 1)       # flakes left after the last pass fade away
    alpha = ImageChops.multiply(ImageChops.invert(scratched.filter(ImageFilter.GaussianBlur(1.5))), shape)
    card = prize.copy()
    f = foil.copy()
    f.putalpha(alpha.point(lambda v: v * leftover))
    card.alpha_composite(f)
    if coin:
        cx, cy = coin
        r = brush * 0.75
        d = ImageDraw.Draw(card)
        d.ellipse([cx - r + 4, cy - r + 6, cx + r + 4, cy + r + 6], fill=(0, 0, 0, 90))
        d.ellipse([cx - r, cy - r, cx + r, cy + r], fill=(196, 160, 84), outline=(150, 115, 50), width=4)
        d.ellipse([cx - r * 0.6, cy - r * 0.6, cx + r * 0.6, cy + r * 0.6], outline=(225, 195, 120), width=3)
    card.putalpha(ImageChops.multiply(card.getchannel("A"), shape))
    x0, y0 = (w - cw) // 2, round(h * Y - ch / 2)
    img.alpha_composite(shadow, (x0 - 20, y0 - 12))
    img.alpha_composite(card, (x0, y0))
    fade = 1 - min(max((t - HIDE) / 0.3, 0), 1)
    if fade < 1:
        img.putalpha(img.getchannel("A").point(lambda v: v * fade))
    return img


def probe(path):
    info = json.loads(subprocess.check_output(["ffprobe", "-v", "error", "-select_streams", "v:0", "-show_entries",
                                               "stream=width,height,r_frame_rate:format=duration", "-of", "json", path]))
    s = info["streams"][0]
    num, den = s["r_frame_rate"].split("/")
    return s["width"], s["height"], s["r_frame_rate"], float(num) / float(den), float(info["format"]["duration"])


def render(src, out):
    """Draw overlay(t) on every frame of src and save to out, keeping the audio."""
    ff = subprocess.Popen(["ffmpeg", "-y", "-v", "error", "-i", src,
                           "-f", "rawvideo", "-pix_fmt", "rgba", "-s", f"{w}x{h}", "-r", rate, "-i", "-",
                           "-filter_complex", "[0:v][1:v]overlay=shortest=1,format=yuv420p[v]",
                           "-map", "[v]", "-map", "0:a?", "-c:v", "libx264", "-crf", "18", "-c:a", "copy", out],
                          stdin=subprocess.PIPE)
    for i in range(math.ceil(duration * fps)):
        ff.stdin.write(overlay(i / fps).tobytes())
    ff.stdin.close()
    if ff.wait():
        sys.exit("ffmpeg failed")


src, out = sys.argv[1:3]
w, h, rate, fps, duration = probe(src)
cw, ch = round(w * CARD_W), round(h * CARD_H)
brush = ch * 0.16                                     # coin scratch radius in pixels
shape = rounded((cw, ch), round(ch * 0.1))
shadow = Image.new("RGBA", (cw + 40, ch + 40))
shadow.paste((0, 0, 0, 120), (20, 22), shape)
shadow = shadow.filter(ImageFilter.GaussianBlur(10))
prize, foil = prize_layer(), foil_layer()
path, drawn, rng = coin_path(), 0, np.random.default_rng(2)
scratched = Image.new("L", (cw, ch))
render(src, out)

Find 3x winning ads

Recharm cuts your ad footage into tagged, searchable clips: hooks, testimonials, product shots. Find the shots that win, add the effect with Claude, and ship 3x more ad edits.

Start 14-day free trial