| Input image | Colorful drawing animation |
|---|---|
![]() |
![]() |
Generate it with the color pipeline:
python sketch2svg_color.py input.png 16
python render_color.py input_color.svg --duration 5.0 --delay 0.05 --scale 3.55 --output-file outputThe color pipeline quantizes the image into up to 16 colors, traces each color layer separately with potrace, and renders a colored drawing animation with Manim. Generated SVGs include their own background color, so they can be moved or shared without a companion file.
Convert a static image into a smooth drawing animation using Manim.
This project takes a doodle, photo, or sketch, converts it into an SVG vector graphic, and renders it into an animated MP4 video with Manim.
It also prepends the last frame to the start of the video, creating a short pause for a more polished look.
- Image → Sketch → SVG → Animated MP4
- Adjustable animation parameters:
- Animation duration (seconds)
- Subpath delay ratio (fractional delay between subpaths)
- Scale factor (zoom in/out)
- Drawing style (
linear,smooth,there_and_back,wiggle) - Video format: landscape 16:9 (
1920x1080) or portrait 9:16 (1080x1920)
- High-quality vector rendering powered by Manim
- Optional color-preserving SVG and video generation
- Automatic last-frame prepend for a smooth intro
- Simple bilingual Gradio web interface (English / Chinese)
git clone https://github.com/yourusername/sketch-to-motion.git
cd Sketch2MotionMake sure you have Python 3.9+ installed.
pip install -r requirements.txtKey dependencies:
- Gradio
- Manim
- ffmpeg (must be installed and in your PATH)
- Potrace (must be installed and in your PATH)
Install Manim:
Install ffmpeg:
- Windows: Download from official site and add
binfolder to PATH - macOS:
brew install ffmpeg - Linux:
sudo apt install ffmpegor use your package manager
Install Potrace:
- macOS:
brew install potrace - Linux:
sudo apt install potraceor use your package manager
python app.pyAccess the app at:
http://127.0.0.1:7880
- Use the Language / 语言 selector to switch between English and Chinese.
- Upload a doodle/photo as the Input image. Enable Preserve colors to use the color pipeline and choose its palette size.
- Click Generate sketch to convert it to SVG.
- Adjust Animation duration, Subpath delay ratio, Scale factor, and Drawing style.
- Choose the Video format (landscape is selected by default), then click Generate video to render and preview the animation.
- Download the generated MP4.


