# fogleman/gg

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/fogleman-gg).**

4,778 stars · 383 forks · Go · MIT

## Links

- GitHub: https://github.com/fogleman/gg
- Homepage: https://godoc.org/github.com/fogleman/gg
- awesome-repositories: https://awesome-repositories.com/repository/fogleman-gg.md

## Description

gg is a Go 2D graphics library and vector graphics engine designed for programmatic image generation. It provides a canvas rendering API to create custom 2D shapes, paths, and visual assets, which can be exported as PNG and JPG files.

The toolkit enables the construction of complex geometry using Bezier curves and custom paths. It supports a variety of rendering operations, including filling and stroking paths, applying linear and radial gradients, and utilizing surface patterns.

The library covers a broad range of capabilities, including text rendering with word wrapping and dimension measurement, coordinate transformations such as rotation and scaling, and the use of alpha-mask clipping to restrict drawing areas. It also manages graphics state through a stack-based system to support nested transformations and styles.

## Tags

### Graphics & Multimedia

- [2D Vector Graphics Libraries](https://awesome-repositories.com/f/graphics-multimedia/2d-vector-graphics-libraries.md) — Provides a comprehensive API for drawing shapes, paths, and text in a two-dimensional vector space using Go.
- [Canvas Rendering](https://awesome-repositories.com/f/graphics-multimedia/canvas-rendering.md) — Provides a raster-based canvas rendering engine for programmatic image generation in Go.
- [Canvas and Paint APIs](https://awesome-repositories.com/f/graphics-multimedia/canvas-and-paint-apis.md) — Offers programmatic interfaces for defining drawing styles and executing rendering commands on a surface.
- [Canvas Coordinate Transformations](https://awesome-repositories.com/f/graphics-multimedia/canvas-coordinate-transformations.md) — Implements canvas coordinate modifications including translation, scaling, rotation, and skewing.
- [Programmatic Image Toolkits](https://awesome-repositories.com/f/graphics-multimedia/generative-art-toolkits/programmatic-image-toolkits.md) — Provides a set of tools for creating PNG and JPG files through 2D drawing and font rendering.
- [Go Graphics Libraries](https://awesome-repositories.com/f/graphics-multimedia/go-graphics-libraries.md) — Provides a specialized toolkit for rendering 2D shapes and text using a coordinate-based canvas in Go.
- [Shape Drawing](https://awesome-repositories.com/f/graphics-multimedia/graphics-and-media/shape-drawing.md) — Renders geometric primitives including circles, rectangles, ellipses, polygons, and arcs. ([source](https://godoc.org/github.com/fogleman/gg))
- [Path Geometry Construction](https://awesome-repositories.com/f/graphics-multimedia/graphics-and-media/shape-drawing/path-stroking/path-geometry-construction.md) — Enables the construction of complex geometry using cubic and quadratic Bezier curves and custom paths.
- [Composite Path Construction](https://awesome-repositories.com/f/graphics-multimedia/graphics-and-media/shape-drawing/polygon-drawing/composite-path-construction.md) — Constructs complex vector paths by combining linear segments and Bezier curves. ([source](https://godoc.org/github.com/fogleman/gg))
- [Fill and Stroke Styles](https://awesome-repositories.com/f/graphics-multimedia/graphics-and-media/shape-drawing/sketchy-fill-generators/fill-and-stroke-styles.md) — Applies colors, gradients, and patterns to define the interior and boundaries of vector shapes. ([source](https://godoc.org/github.com/fogleman/gg))
- [Transformation Stacks](https://awesome-repositories.com/f/graphics-multimedia/graphics-engines-rendering/rendering/coordinate-viewport-transformations/matrix-transformation-engines/affine-matrix-transformations/transformation-stacks.md) — Implements a transformation stack to save and restore nested matrix transformations.
- [Vector Rasterizers](https://awesome-repositories.com/f/graphics-multimedia/graphics-engines-rendering/rendering/vector-rendering-pipelines/vector-graphics-renderers/vector-rasterizers.md) — Converts mathematical vector definitions, including Bezier curves and paths, into pixel-based raster images.
- [Text Rendering](https://awesome-repositories.com/f/graphics-multimedia/graphics-engines-rendering/text-rendering.md) — Renders text strings onto a canvas with support for fonts, alignment, and word wrapping. ([source](https://cdn.jsdelivr.net/gh/fogleman/gg@main/README.md))
- [Raster Image Renderers](https://awesome-repositories.com/f/graphics-multimedia/graphics-rendering-engines/raster-image-renderers.md) — Implements a rendering engine to produce high-quality PNG and JPG files with custom layouts and gradients.
- [Graphics State Management](https://awesome-repositories.com/f/graphics-multimedia/graphics-state-management.md) — Manages graphics state by saving and restoring stacks of style and transformation settings. ([source](https://cdn.jsdelivr.net/gh/fogleman/gg@main/README.md))
- [Raster Image Exporters](https://awesome-repositories.com/f/graphics-multimedia/raster-image-exporters.md) — Exports final visual output to disk or writers in PNG and JPG formats. ([source](https://godoc.org/github.com/fogleman/gg))
- [Canvas Image Positioning](https://awesome-repositories.com/f/graphics-multimedia/canvas-image-positioning.md) — Provides logic for aligning and positioning external images on the rendering canvas. ([source](https://cdn.jsdelivr.net/gh/fogleman/gg@main/README.md))
- [Dynamic Image Renderers](https://awesome-repositories.com/f/graphics-multimedia/dynamic-image-renderers.md) — Enables programmatic generation of images like banners and charts based on runtime functions.
- [Gradient Renderers](https://awesome-repositories.com/f/graphics-multimedia/graphics-and-media/colors/gradient-renderers.md) — Renders smooth linear and radial color transitions across graphical elements. ([source](https://cdn.jsdelivr.net/gh/fogleman/gg@main/README.md))
- [Image Blitting](https://awesome-repositories.com/f/graphics-multimedia/image-blitting.md) — Allows placing external image data onto the drawing canvas by mapping source pixels to target coordinates.
- [Clipping Regions](https://awesome-repositories.com/f/graphics-multimedia/path-and-canvas-drawing/clipping-regions.md) — Defines path-based clipping regions to restrict the visible rendering area of the canvas. ([source](https://cdn.jsdelivr.net/gh/fogleman/gg@main/README.md))
- [Text Dimension Measurement](https://awesome-repositories.com/f/graphics-multimedia/text-dimension-measurement.md) — Calculates the exact pixel width and height of text segments for custom layout rendering. ([source](https://godoc.org/github.com/fogleman/gg))

### User Interface & Experience

- [Clipping Path Applications](https://awesome-repositories.com/f/user-interface-experience/clipping-utilities/masking-utilities/clipping-path-applications.md) — Provides tools for restricting rendering areas using defined vector paths or alpha masks.
- [Surface Patterns](https://awesome-repositories.com/f/user-interface-experience/presentation-frameworks/slide-layout-styling/gradient-backgrounds/surface-patterns.md) — Supports filling shapes and strokes using repeating surface patterns and gradients. ([source](https://godoc.org/github.com/fogleman/gg))

### Part of an Awesome List

- [Image Processing](https://awesome-repositories.com/f/awesome-lists/media/image-processing.md) — Pure Go 2D rendering library.
