Skip to content
Search

Skia Canvas

lastmod 2024-12-05created 2022-05-062 edits

A browserless implementation of the HTML Canvas drawing API for Node

About

  • Skia Canvas is a library that implements the HTML Canvas drawing API for Node.js without a browser.
  • Based on Google's Skia graphics engine, it produces results similar to Chrome's <canvas>

    element.

  • Well suited for rendering hardware-accelerated graphics on desktops and servers, or for outputting various image formats.

Features

  • Rendering happens on the GPU, so it is fast and compact, and work is handled by native code written in Rust and C++.
  • Can render to windows using the OS-native graphics pipeline and provides a browser-like UI event framework.
  • Can generate images in raster (JPEG, PNG, WEBP) and vector (PDF, SVG) formats.
  • Images can be saved to files, returned as buffers, or encoded as dataURL strings.
  • Uses native threads in a user-configurable worker pool for asynchronous rendering and file I/O.
  • Can create multiple 'pages' on a given canvas and output them as a single multi-page PDF or as an image sequence saved to multiple files.
  • Can simplify, blunt, combine, excerpt, and atomize Bézier paths using efficient boolean operations or point-to-point interpolation.
  • Provides 3D perspective transformations in addition to scaling, rotation, and translation.
  • Can fill shapes with vector-based textures in addition to bitmap-based patterns, and can stroke lines with custom markers.
  • Fully supports CSS filter image-processing operators.
  • Provides rich typographic control, including multi-line and word-wrapped text, line-by-line text metrics, small caps, ligatures, and other OpenType features.
  • Non-system fonts can be loaded from local files and used.

2.0 Release

  • Release v2.0.0 · samizdatco/skia-canvas
  • An HTML canvas drawing API for Node.js implemented without a browser
  • Based on Google's Skia graphics engine, produces results very similar to Chrome's <canvas> element
  • Major changes in 2.0
    • SVG & WEBP support
    • WOFF & WOFF2 font support
    • Image objects support the standard on/off/once EventEmitter methods
    • drawImage/createPattern now work with ImageData objects in addition to the existing Image and Canvas
    • Minimum Node version 12.22+, 14.17+, or 16+

See also

Favorite site

author Zer0 sitemap