Skip to content

About

convert photo or sketch to motion video

Resources

Stars

381 stars

Watchers

2 watching

Forks

Repository files navigation

Sketch to Motion Preview

Sketch to Motion

English | 简体中文

Colorful Version Demo

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 output

The 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.


Features

  • 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)

Installation

1. Clone this repository

git clone https://github.com/yourusername/sketch-to-motion.git
cd Sketch2Motion

2. Install Python dependencies

Make sure you have Python 3.9+ installed.

pip install -r requirements.txt

Key dependencies:

Install Manim:

Installing Manim

Install ffmpeg:

  • Windows: Download from official site and add bin folder to PATH
  • macOS: brew install ffmpeg
  • Linux: sudo apt install ffmpeg or use your package manager

Install Potrace:

  • macOS: brew install potrace
  • Linux: sudo apt install potrace or use your package manager

Usage

Launch the Gradio app

python app.py

Access the app at:

http://127.0.0.1:7880

3. Web interface workflow

  1. Use the Language / 语言 selector to switch between English and Chinese.
  2. Upload a doodle/photo as the Input image. Enable Preserve colors to use the color pipeline and choose its palette size.
  3. Click Generate sketch to convert it to SVG.
  4. Adjust Animation duration, Subpath delay ratio, Scale factor, and Drawing style.
  5. Choose the Video format (landscape is selected by default), then click Generate video to render and preview the animation.
  6. Download the generated MP4.

About

convert photo or sketch to motion video

Resources

Stars

381 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages