Open Source Go API for Vector Drawings Processing

Pure Go Library that allows developers to export vector drawings to SVG, PDF, EPS, raster images like PNG, JPG, GIF & many more.

Canvas is an open source pure Go vector drawing library that provides complete drawing functionality the same as that of HTML5 canvas API through WASM, and OpenGL. The library enables software developers to export vector to SVG, PDF, EPS, raster images like PNG, JPG, GIF, and many more inside their own applications.

The library can be considered as a good Go alternative for Cairo or node-canvas. The library has included support for a wide range of features related to path manipulation such as flattening, stroking and dashing, etc. It has included support for text formatting and fonts embedding. You can also convert fonts to outlines with ease. Developers can easily use features plotting of graphs, maps, and documents.

Previous Next

Getting Started with Canvas

The easiest and recommended way to install Canvas is via GitHub.

Install Imaging via GitHub

go get -u https://github.com/tdewolff/canvas.git

Draw and Manage Text via Go API

The open source Canvas library has included several important features related to drawing and managing text using Go commands. The library has included very strong support for text formatting and has a good text formatter and embeds fonts or converts these to outlines. It supports features like fit text into the box, apply styles and text decorations, typographic substitutions, draw text as a path, painting rasterized images, and much more.

Building & Managing Paths

The open source Canvas library gives software developers the capability to construct paths inside their own applications. A path usually consists of multiple subpaths which each starts with a MoveTo command. Please do remember that overlapping paths can cancel. You can easily extract information from these paths. You can also manipulate, transform, append path, join path, reverse the direction of the path.

Render Text Document to PNG

The open source Canvas library enables software developers to render text documents to PNG format inside their own application using Go programming commands. The library allows generating an image via canvas and being able to generate a PNG from that image with ease.