infogfx

package module
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 25, 2024 License: MIT Imports: 13 Imported by: 0

README

infogfx-go

Golang image generation library for creating infographics like virtual IDs

Purpose

The intention for this golang library is for re-usable functions on various project I work on. Taking the lower-level extended libraries for Go's image and text packages and making a higher level one for generating graphics such as but not limited to:

  • Virtual ID (User joins a discord server and the discord bot generates an image graphic)
  • Table list
  • Pie Chart

To-Do Features

  • Implement a function that outputs a fully generated image from variadic inputs.
  • Implement a function that generates infographic table from variadic inputs.
  • Implement a function that generates a pie chart from variadic inputs.
  • Implement a Go test.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrFontLoadFailed  = errors.New("Failed to load Font")
	ErrFontParseFailed = errors.New("Failed to parse font")
	ErrFontFaceFailed  = errors.New("Failed to generate font face")
)
View Source
var (
	ErrImageLoadFailed        = errors.New("Failed to load image file")
	ErrImageDecodeFailed      = errors.New("Failed to decode image")
	ErrImageFormatUnsupported = errors.New("Image format is not supported")
	ErrImageFetchFailed       = errors.New("Failed to fetch image from URL")
)

Functions

func AddTextLabel

func AddTextLabel(img *image.RGBA, textFace font.Face, x, y int, label string)

func CardTemplate

func CardTemplate(templateImg image.Image, inputs ...interface{}) (image.Image, error)

func ResourceLoadFont

func ResourceLoadFont(location string, size float64) (font.Face, error)

func ResourceLoadImage

func ResourceLoadImage(location string) (image.Image, error)

func ResourceUrlLoadImage

func ResourceUrlLoadImage(url string) (image.Image, error)

func ScaleImage

func ScaleImage(img image.Image, newWidth, newHeight int) *image.RGBA

Types

type ImageInput

type ImageInput struct {
	Image    image.Image
	Width    int
	Height   int
	XPadding int
	YPadding int
}

type TextInput

type TextInput struct {
	Text     string
	X        int
	Y        int
	TextFace font.Face
	Color    color.Color
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL