JavaScript is required to run the Speedpaint studio and export drawing videos.

Techniques4 min read · Published September 12, 2026

How Speedpaint plans strokes from an image

The engineering behind Speedpaint: how source pixels become vector paths, why strokes cluster by object, and how frames render at 60 FPS.

Parv Shah
Parv ShahFounder & Lead Engineer
Drawing illustration used as the article cover

The difference between pixels and drawing paths

A digital photograph is a raster grid of pixels. It carries color and luminance, but no record of how an artist would physically draw it. Video generation models often hallucinate transitions between frames, creating shimmering or morphing artifacts. Speedpaint takes a different approach: it extracts the geometric structure of an image, plans a realistic sequence of strokes, and renders that plan frame by frame at 60 FPS using an explicit drawing engine.

Step 1: High-fidelity sketch synthesis

The engine begins by turning the input image into a drawing in one of four styles: Line art, Shaded sketch, Anime, or Charcoal. The output is a clean, high-resolution source drawing. In Line art mode, paper background is normalized to pure white (#FFFFFF) and all lines are rendered in sharp monochrome black, ensuring zero color contamination before vectorization.

Step 2: Skeletonization and medial axis extraction

Next, the image enters the stroke extraction engine (generation/stroke_logic.py). Using OpenCV and NumPy, the raster drawing is binarized and reduced to its topological skeleton—a 1-pixel-wide medial axis representation of every visible contour. During this stage:
  • Coordinates are processed internally in [Y, X] (row, col) matrix space to prevent spatial distortion.
  • Microscopic stippling fragments (< 8.0px) are filtered out, preventing jittery micro-movements.
  • Continuous strokes are classified into outlines, primary internal features, secondary details, and hatching groups.
  • Step 3: Single-pass object clustering

    Human artists complete one discrete subject at a time—drawing the face, then the hair, then the collar—before moving elsewhere. They do not scatter random dots across four corners of the canvas. Speedpaint’s trajectory planner groups paths by spatial and contour proximity. Strokes belonging to the same object boundary are clustered and sequenced sequentially, creating a human-like, single-pass completion order.

    Step 4: Vector pacing and pencil physics

    Once stroke order is determined, the vector animation planner calculates the drawing dynamics:
  • Velocity curves: Long sweeping contours are drawn with smooth acceleration; intricate details and sharp corners cause natural deceleration.
  • Tangent-aligned pencil tilt: The virtual pencil tilts dynamically along the instantaneous tangent vector of each stroke path, smoothed across neighboring sample points.
  • Reveal radius: The pencil tip calibrated reveal radius progressively exposes soft tones and shading beneath the line work.
  • Step 5: Multi-worker canvas rendering

    The planned trajectory and timing instructions are serialized into standard Cartesian canvas points and dispatched to a distributed CPU-based render container running Node.js Canvas and FFmpeg. Frames are rendered in parallel at 60 FPS and encoded into H.264 MP4. Nothing is guessed between frames; every line corresponds to an exact vector path in the stroke plan.

    Turn any photo into a drawing video

    Eligible new accounts receive $0.20 free after email verification. Check the cost of your selected settings in Studio before creating a video.

    Related articles & drawing guides

    Explore related techniques and practical workflows in the Speedpaint Journal.

    Tags: #Stroke planning #Rendering