Perfect Freehand

Perfect Freehand provides drawing tools for creating pressure-sensitive freehand lines.

github.com/steveruizok/perfect-freehand
Perfect Freehand homepage screenshot

About Perfect Freehand

Perfect Freehand is an open-source TypeScript library for drawing pressure-sensitive freehand lines. It exports a getStroke function that takes an array of input points, such as those recorded from mouse or pointer movement, and returns a new array of outline points forming a polygon that surrounds the input. Those points can then be rendered with whichever technology the developer prefers, with examples given for SVG and HTML Canvas. Stroke appearance can be customized through an options object, including settings such as size and thinning.

By default the library simulates pressure based on the distance between input points. To use real pressure from a pen or stylus, pressure is supplied as the third number for each point and the simulatePressure option is set to false. Points may be provided as arrays of arrays or as arrays of objects, though object points are converted internally to array points, which the source notes affects performance. Community ports exist in Dart, Odin, Python and Rust, and there is a Figma plugin for designers. Pricing is not stated in the source.

Key features

  • getStroke returns polygon outline points from an array of input points
  • Supports simulated pressure or real pressure from pen or stylus
  • Accepts points as arrays of coordinates or as objects
  • Stroke appearance configurable via options such as size and thinning
  • Output can be rendered with any technology, including SVG and canvas
  • Community ports available in Dart, Odin, Python and Rust
Best for: Developers building drawing, annotation or note-taking interfaces who need pressure-sensitive freehand stroke outlines they can render themselves.
Good for
  • Open-source TypeScript library installable via npm or yarn
  • Separates stroke generation from rendering, so output works with any graphics technology
  • Handles both simulated pressure and real stylus pressure input
Watch out for
  • Point objects are converted internally to arrays, which affects performance
  • No rendering is provided; developers must draw the resulting points themselves
  • The source lists no pricing information

Perfect Freehand at a glance

Type
Open-source project
Pricing
Not confirmed. Check the site
Open source
Yes · Source code
Language
English
Last checked
Oct 6, 2026 · Online when checked
Listed
Oct 5, 2026

Perfect Freehand alternatives

Tools and sites you could use instead, ranked by how closely they match.

All 24 alternatives

DrawSVG

drawsvg.org/drawsvg.html

Draw, edit, style, and animate vector graphics in DrawSVG, an online SVG editor.

Popular in Image Creation & Editing

Well-known listings from the same topic.

All 244

Perfect Freehand FAQ

How is the library installed?
With npm install perfect-freehand or yarn add perfect-freehand.
How does it handle pressure?
By default getStroke simulates pressure from the distance between input points. To use real pressure from a pen or stylus, supply pressure as the third number for each point and set simulatePressure to false.
Does it require a particular rendering framework?
No. getStroke returns outline points that form a polygon, and you can render them using whichever technology you prefer; the documentation gives examples for SVG and HTML Canvas.
Is something wrong or out of date?

Tell us and an editor will check it.

Own this website?

Claim the listing and suggest updates yourself. An editor checks every claim first.

Claim this listing