Skip to main content

ThorVG for Node.js

Headless vector graphics and Lottie rendering for Node.js.

import { init } from 'thorvg-canvas';

const TVG = await init();
const canvas = new TVG.Canvas({ width: 512, height: 512 });

const animation = new TVG.LottieAnimation().load(lottieJson);
const picture = animation.picture!;
picture.size(512, 512);
canvas.add(picture);

animation.frame(30);
await canvas.renderAsync();
await canvas.toFile('thumbnail.png');

WebCanvas API

The @thorvg/webcanvas API in Node.js. Drawing code written for the browser runs on the server as is.

Native and headless

ThorVG runs natively through Node-API and renders on the CPU into memory.

Vector, Lottie, SVG and text

Shapes, gradients, masks, scene effects, Lottie animations with slots and markers, SVG, PNG, JPG and WebP pictures, and TrueType or OpenType text. Save frames as PNG or read the raw pixels.