1. Products
  2.   Image
  3.   GO
  4.   Canvas
 
  

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.

What is Canvas?

Crafted for Go developers seeking advanced drawing solutions, Canvas is an open-source, pure Go vector drawing library that delivers comprehensive drawing functionality mirroring the HTML5 Canvas API. It seamlessly operates across platforms via WebAssembly (WASM) and OpenGL backends, enabling the creation of complex graphics directly within Go applications. A powerful alternative to libraries like Cairo or node-canvas, this tool empowers developers to export their work to versatile vector formats including SVG, PDF, and EPS, as well as standard raster images like PNG, JPG, and GIF, all from a unified codebase.

The library excels with its extensive support for sophisticated path manipulation, offering precise control over operations such as flattening, stroking, and dashing. It further enhances project capabilities with robust text formatting, full font embedding, and the ability to convert fonts to outlines for consistent rendering. Developers can efficiently leverage Canvas for a wide array of practical applications, from feature plotting of intricate graphs and detailed maps to generating fully formatted documents, making it an indispensable tool for high-quality graphical output in Go.

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 fitting text into the box, applying styles and text decorations, typographic substitutions, drawing 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 start 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, and 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. 

 English