sticker: Index | Files

package sticker

import ""


Package Files



var (
    // ErrInvalidDimensions gets returned when the requested image has an invalid width or height
    ErrInvalidDimensions = errors.New("values for width or height must be positive")

    // ErrMissingFontOption gets returned when there's no font specified in the options
    ErrMissingFontOption = errors.New("no font option specified")

type ImageGenerator Uses

type ImageGenerator struct {
    // contains filtered or unexported fields

ImageGenerator lets you generate images & placeholders

func NewImageGenerator Uses

func NewImageGenerator(options Options) (*ImageGenerator, error)

NewImageGenerator returns a new ImageGenerator

func (*ImageGenerator) NewPlaceholder Uses

func (p *ImageGenerator) NewPlaceholder(text string, width, height int) (image.Image, error)

NewPlaceholder returns a placeholder image with the given text, width & height

type Options Uses

type Options struct {
    TTFPath         string
    TTF             []byte
    Foreground      color.RGBA
    Background      color.RGBA
    BackgroundImage image.Image
    MarginRatio     float64

Options contains all the settings for an ImageGenerator

Package sticker imports 9 packages (graph). Updated 2019-08-31. Refresh now. Tools for package owners.