Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. Go
  3. canvas

canvas

MITGo

A Go vector graphics library that renders to SVG, PDF, raster images, HTML Canvas, and more with advanced text and path operations.

GitHubGitHub
1.8k stars121 forks0 contributors

What is canvas?

Canvas is a vector graphics library written in Go that provides a unified API for rendering to multiple formats including SVG, PDF, raster images, and HTML Canvas. It solves the problem of generating high-quality vector graphics with advanced text layout and precise path operations in Go applications.

Target Audience

Go developers needing to generate vector graphics, PDFs, or complex text layouts, such as those building charting libraries, document generators, or graphics-intensive applications.

Value Proposition

Developers choose Canvas for its numerically stable path operations, multi-format output from a single API, and production-ready performance with optimized rasterization, making it a robust alternative to C-based libraries like Cairo.

Overview

Vector graphics in Go

Use Cases

Best For

  • Generating PDF reports with complex text layouts and vector graphics in Go
  • Creating SVG or raster images from vector paths with precise dashing and stroking
  • Building charting or plotting libraries that require high-quality text rendering
  • Developing generative art tools that need stable boolean operations on paths
  • Rendering maps or GIS data with degenerate geometries and overlapping segments
  • Converting LaTeX formulas to vector paths for inclusion in graphics

Not Ideal For

  • Real-time interactive applications requiring sub-millisecond rendering latencies, such as video games or live animations
  • Projects where binary size must be minimized, due to dependencies on HarfBuzz and FriBidi with potential CGO overhead
  • Teams needing extensive, beginner-friendly documentation and tutorials for quick onboarding
  • Simple image manipulation tasks that don't require vector graphics or multi-format output

Pros & Cons

Pros

Multi-format Rendering

Outputs to SVG, PDF, EPS, raster images, HTML Canvas via WASM, and more from a single API, as shown in the README's feature list and examples like the HTML Canvas demo.

Advanced Text Layout

Uses HarfBuzz for shaping, FriBidi for bidirectionality, and Knuth's algorithm for line breaking, supporting mixed scripts and fonts, evidenced by the text formatting examples in Figure 1.

Stable Path Operations

Provides numerically stable boolean operations (AND, OR, XOR, etc.) with O((n+k) log n) complexity, tested extensively with degenerate data like OpenStreetMap shapes.

High Performance Optimization

Features an ASM-optimized rasterizer that benchmarks show is at least twice as fast as alternatives like Cairo in extreme cases, per the README's performance discussion.

Cons

API Instability

Recent changes in the README, such as renamed methods and parameter adjustments, indicate breaking updates that can disrupt existing codebases.

Bug Potential

The author admits the library's vast scope and complexity likely hide bugs, with coverage still lacking despite unit and fuzz tests.

CGO Dependency Complexity

Optimal performance with HarfBuzz and FriBidi requires CGO, which complicates cross-compilation and adds external dependencies.

Open Source Alternative To

canvas is an open-source alternative to the following products:

n
node-canvas

node-canvas is a Cairo-backed Canvas implementation for Node.js that allows server-side generation of images and graphics using the HTML5 Canvas API.

C
Cairo

Cairo is a 2D graphics library that provides vector drawing capabilities with support for multiple output targets including screen, PDF, and SVG.

Frequently Asked Questions

Quick Stats

Stars1,825
Forks121
Contributors0
Open Issues20
Last commit9 days ago
CreatedSince 2017

Tags

#font-embedding#opengl#eps#canvas#go-library#svg-renderer#svg#html-canvas#graphics-library#pdf-generation#path-manipulation#rasterizer#path#cairo#vector-graphics#text-rendering#2d-graphics#pdf

Built With

G
Gio
G
Go
W
WASM
H
HarfBuzz
O
OpenGL

Included in

Go169.1k
Auto-fetched 17 hours ago

Related Projects

gocvgocv

Go package for computer vision using OpenCV 4 and beyond. Includes support for DNN, CUDA, OpenCV Contrib, and OpenVINO.

Stars7,474
Forks903
Last commit1 month ago
imaginaryimaginary

Fast, simple, scalable, Docker-ready HTTP microservice for high-level image processing

Stars6,073
Forks499
Last commit8 months ago
imagingimaging

Imaging is a simple image processing package for Go

Stars5,744
Forks482
Last commit2 years ago
gggg

Go Graphics - 2D rendering in Go with a simple API.

Stars4,790
Forks383
Last commit2 years ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub