letuandat131/whiteboard-animation-vi
Image-to-whiteboard animation: character-first coloring, ink-aware color groups, animated photographic hands, Gradio UI, and CUDA/NVENC rendering. Developed in Vietnam.
What it solves
Turning a static illustration into a whiteboard-style animation is tedious and often looks mechanical. This project automates the process: you upload an RGB/RGBA image, choose timing and style, and get an MP4 where lines are drawn, characters are colored before the background, and photographic hands move naturally as if drawing and painting.
How it works
It works in stages. First, the image is fitted to the output frame, its lines are extracted and cleaned, and optionally a foreground mask is detected (using an anime segmentation model called ISNet) so that characters are separated from scenery. Second, the line map is drawn using a grid path. Third, the detected foreground is colored one color group at a time; colors are grouped by similarity in Lab space and ink boundaries help split connected regions, so the brush strokes faithfully reveal pixels of each color group. Fourth, the background is colored using one of two modes: Detailed (same color-group ordering and refined routing) or Quick (each ink-aware cluster finished left-to-right). Finally, the finished frame is held and exported as an MP4 along with a JSON render report. Throughout, a route refinement shortens hand travel while preserving the subject/color order, and the brush contact and pixel reveal share one timeline with eased movement and pen lifts.
Who it’s for
This is aimed at artists, animators, or hobbyists who want to create whiteboard-style explainer videos from illustrations without manually drawing every stroke. It’s also useful for developers who want to integrate the process via the included Python API. The app runs locally on Windows (Python 3.11/3.12) and can leverage NVIDIA GPU acceleration for faster rendering, though a CPU-only fallback is provided.
Highlights
- Characters before scenery: foreground is colored first, keeping characters visible early.
- Color-grouped strokes: similar colors are grouped and painted together, preserving the source image's colors and shading.
- Ink-aware boundaries: region separation uses ink lines, so connected areas are split more naturally.
- Moving real hands: separate hand assets include wrist, finger, and shadow motion, making the animation feel more authentic.
- Two drawing modes: Detailed (color-group order everywhere) and Quick (left-to-right background clusters).
- Cleaner lines: multiscale contrast filtering and small-component cleanup remove specks from the extracted line map.
- Local UI and GPU rendering: Gradio-based interface exposes all settings; CUDA accelerates clustering and frame composition, and NVENC can encode directly from GPU frames.
- Python API: a simple
render_video()function lets you script the animation process.
Related
- Project
- Project
- Project
- Project