engines

package
v0.0.0-...-b2a5d9a Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2016 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ContentTypes = map[string]string{
	"jpeg": "image/jpeg",
	"jpg":  "image/jpeg",
	"png":  "image/png",
	"bmp":  "image/bmp",
	"gif":  "image/gif",
}
View Source
var Fit = &Operation{
	"fit",
}
View Source
var Flip = &Operation{
	"flip",
}
View Source
var FlipTransformations = map[string]ImageTransformation{
	"h": imaging.FlipH,
	"v": imaging.FlipV,
}
View Source
var Formats = map[string]imaging.Format{
	"jpeg": imaging.JPEG,
	"jpg":  imaging.JPEG,
	"png":  imaging.PNG,
	"gif":  imaging.GIF,
	"bmp":  imaging.BMP,
}
View Source
var Operations = map[string]*Operation{
	Resize.Name:    Resize,
	Thumbnail.Name: Thumbnail,
	Flip.Name:      Flip,
	Rotate.Name:    Rotate,
	Fit.Name:       Fit,
}
View Source
var Resize = &Operation{
	"resize",
}
View Source
var Rotate = &Operation{
	"rotate",
}
View Source
var RotateTransformations = map[int]ImageTransformation{
	90:  imaging.Rotate90,
	270: imaging.Rotate270,
	180: imaging.Rotate180,
}
View Source
var Thumbnail = &Operation{
	"thumbnail",
}

Functions

func ImageSize

func ImageSize(e image.Image) (int, int)

Types

type Engine

type Engine interface {
	Resize(img *image.ImageFile, width int, height int, options *Options) ([]byte, error)
	Thumbnail(img *image.ImageFile, width int, height int, options *Options) ([]byte, error)
	Transform(img *image.ImageFile, operation *Operation, qs map[string]string) (*image.ImageFile, error)
	Flip(img *image.ImageFile, pos string, options *Options) ([]byte, error)
	Rotate(img *image.ImageFile, deg int, options *Options) ([]byte, error)
	Fit(img *image.ImageFile, width int, height int, options *Options) ([]byte, error)
}

type GoImageEngine

type GoImageEngine struct {
	DefaultFormat  string
	Format         string
	DefaultQuality int
}

func (*GoImageEngine) Fit

func (e *GoImageEngine) Fit(img *imagefile.ImageFile, width int, height int, options *Options) ([]byte, error)

func (*GoImageEngine) Flip

func (e *GoImageEngine) Flip(img *imagefile.ImageFile, pos string, options *Options) ([]byte, error)

func (*GoImageEngine) Resize

func (e *GoImageEngine) Resize(img *imagefile.ImageFile, width int, height int, options *Options) ([]byte, error)

func (*GoImageEngine) Rotate

func (e *GoImageEngine) Rotate(img *imagefile.ImageFile, deg int, options *Options) ([]byte, error)

func (*GoImageEngine) Scale

func (e *GoImageEngine) Scale(img image.Image, dstWidth int, dstHeight int, upscale bool, trans Transformation) image.Image

func (*GoImageEngine) Source

func (e *GoImageEngine) Source(img *imagefile.ImageFile) (image.Image, error)

func (*GoImageEngine) Thumbnail

func (e *GoImageEngine) Thumbnail(img *imagefile.ImageFile, width int, height int, options *Options) ([]byte, error)

func (*GoImageEngine) ToBytes

func (e *GoImageEngine) ToBytes(img image.Image, format imaging.Format, quality int) ([]byte, error)

func (*GoImageEngine) Transform

func (e *GoImageEngine) Transform(img *imagefile.ImageFile, operation *Operation, qs map[string]string) (*imagefile.ImageFile, error)

func (*GoImageEngine) TransformGIF

func (e *GoImageEngine) TransformGIF(img *imagefile.ImageFile, width int, height int, options *Options, trans Transformation) ([]byte, error)

type ImageTransformation

type ImageTransformation func(img image.Image) *image.NRGBA

type Operation

type Operation struct {
	Name string
}

type Options

type Options struct {
	Upscale bool
	Format  imaging.Format
	Quality int
}

type Result

type Result struct {
	Image    image.Image
	Position int
	Paletted *image.Paletted
}

type Transformation

type Transformation func(img image.Image, width int, height int, filter imaging.ResampleFilter) *image.NRGBA

Jump to

Keyboard shortcuts

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