Whiteboard Hand-Drawn Animation Generator
Generate whiteboard hand-drawn animation videos from input images, the animation is divided into two stages:
- Line art drawing — A hand holding a pen gradually draws a black and white line art on the whiteboard
- Coloring — A hand holding a pen gradually applies color along the contour of the content, restoring the original image
Two modes are supported: Single mode and Batch mode.
Mode Judgment
- If the user provides a single image path → Use single mode
- If the user provides multiple image paths (array/list) → Use batch mode
Single Mode Workflow
Step 1: Prepare the Environment
First use
to detect if the environment is ready:
bash
python <skill目录>/scripts/setup_env.py --check
- If successful (exit code 0): The last line outputs , capture this path for subsequent steps and jump directly to step 2
- If failed (exit code 1): Run the full installation:
bash
python <skill目录>/scripts/setup_env.py
The installation script will automatically create a
virtual environment and install missing dependencies (
,
,
), and the last line also outputs
.
Step 2: Confirm Input Image
Obtain the image path from the user request and confirm the file exists. Supported formats: PNG, JPG, JPEG, BMP, TIFF.
Images with white or light backgrounds work best.
Step 3: Determine Parameters
Collect optional parameters, all parameters have reasonable default values:
| Parameter | Flag | Default Value | Description |
|---|
| Image path | Positional parameter (required) | -- | Input color image path |
| Output directory | | | Video output directory |
| Duration | | | Total video duration (milliseconds) |
| No hand | | Show hand by default | Disable hand overlay effect |
Step 4: Run Generation Script
Use the
obtained in the first step to run the generation script:
bash
<PYTHON_PATH> <skill目录>/scripts/generate_whiteboard.py <图片路径> [--output-dir <目录>] [--duration <毫秒>] [--no-hand]
Example:
bash
<PYTHON_PATH> <skill目录>/scripts/generate_whiteboard.py /path/to/photo.png --output-dir ./output --duration 20000
Step 5: Return Results
The script will print the final video path to stdout, inform the user of this path. Output file naming format:
vid_YYYYMMDD_HHMMSS_h264.mp4
.
Batch Mode Workflow
When the user provides multiple images (image path array) and the corresponding duration array, use batch mode.
Step 1: Prepare the Environment
Same as single mode. First run
to get
.
Step 2: Verify Input
Obtain from the user request:
- Image path array: List of paths for multiple images (required)
- Duration array: List of durations corresponding to the images one-to-one (milliseconds, required)
Must satisfy:
- The length of the image path array and the duration array are the same
- Each image file exists
- Each duration is a positive integer (milliseconds)
Step 3: Run Batch Generation Script
Use
to run the batch script, pass in the one-to-one corresponding image paths and durations through
and
:
bash
<PYTHON_PATH> <skill目录>/scripts/batch_generate.py \
--images /path/to/img1.png /path/to/img2.png /path/to/img3.png \
--durations 10000 15000 8000 \
[--output-dir ./output] [--no-hand]
The script will automatically verify internally:
- The number of and must be consistent
- Each image file must exist
After passing the verification, call the single generation script one by one serially, and print the progress after each completion.
Step 4: Return Results
The script outputs summary information of all tasks (number of successes/failures). Inform the user:
- How many videos were generated in total
- How many succeeded, how many failed
- Output directory path
- If there are failures, list the failed images
Troubleshooting
- : Rerun to ensure complete installation of dependencies.
- Virtual environment creation failed: Confirm that Python 3.8+ is installed on the system and the command is available.
- Single task failure in batch mode: Does not affect the continued execution of subsequent tasks, and the final summary will list all failed items.