Skip to content

dotkalm/SVGWebcam

Repository files navigation

SVG Webcam

IMG_9312 IMG_9312 IMG_9312
screen recording PNG Download SVG Download

What is this?

A high-performance real-time webcam that generates fresh SVG markup every frame. Using WebGL-accelerated edge detection and path generation, SVGWebcam transforms your camera feed into unique line drawings, creating a confounding mix of painterly abstraction and mechanical renderings as a real-time animation.

This real-time SVG tool lets you compose a scene using input controls to adjust thresholds, colors, line widths, fill, and path settings and save the current frame as an SVG that can be opened in the graphics program of your choosing.

Inspiration

I'm a visual artist with a painting background. I often use cnc tools like vinyl cutters and pen plotters that require working with vector files. I've found most methods of converting bitmapped graphics to outlined vector paths to be slow, cumbersome and innefficient. I aim for images that are revealed through a process of discovery and find that tools such as Adobe Illustrator's Image Trace function often result in something that appears too pre-determined and sanitized looking.

I wanted a vector-first image capture tool where I didn't need to open a photo in a graphics program in order to turn it into a vector file.

Features

Swap order of layers using drag handles

Screenshot 2025-11-20 at 2 17 46 PM

Adjust angle of motion blur

motion blur

Toggle bezier curves, add randomness, dash arrays

beziers

Save settings to local storage

Screenshot 2025-11-20 at 6 44 25 PM

Download as .svg

Screenshot 2025-11-20 at 1 52 18 PM

download as .png

download png

toggle facing mode on mobile devices

zoom on mobile using both either facing mode camera

use fills, adjust fill color and opacity

How it works

initWebGL.ts compiles shaders and creates programs, textures, framebuffers.

The outline layer is made from 4 sequential passes to isolate the subject.

  1. Apply blur (gaussian, motion, or lens)
  2. Detect direction of edge
  3. Thin edge
  4. Apply thresholds

The useWebGLCanvas runs the shaders and returns the outputs in frame buffers as a ref.

The background layer takes a shortcut and only applies the selected blur

The useSVGGeneration hook reads the frame buffers and calls edgeDataToSVG where the edge data and user options are used to create SVG markup.

More examples

Screenshot 2025-11-20 at 2 18 15 PM Screenshot 2025-11-20 at 12 53 28 PM Screenshot 2025-11-18 at 11 13 24 PM

About

a webgl2 powered webcam that renders svg as video frames

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published