imagic

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2019 License: MIT Imports: 7 Imported by: 4

README

imagic

A small wrapper around github.com/disintegration/imaging to provide a simpler API for resizing, adding padding and change background color.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotSupported = errors.New("File not supported")

ErrNotSupported returned by Parse when given file is not in a supported format

Functions

func Apply

func Apply(input []byte, operations ...ImageOperation) ([]byte, error)

Apply a list of operations on a given image

Types

type File

type File struct {
	Width  int
	Height int
	Size   int
}

File contains metadata of a given image

func Parse

func Parse(file []byte) (*File, error)

Parse returns the a File if it's in supported format

type ImageOperation

type ImageOperation func(image.Image, string) image.Image

ImageOperation is an operation that can be performed on an image and retun a modified version of it

func ChangeBackground

func ChangeBackground(bgColor color.Color) ImageOperation

ChangeBackground will change given image transparent background to given color

func Padding

func Padding(padding int) ImageOperation

Padding adds a padding based on given value

func Resize

func Resize(size int) ImageOperation

Resize image based on given size

Jump to

Keyboard shortcuts

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