gotransform

package module
v0.0.0-...-8ab03ea Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2017 License: MIT Imports: 9 Imported by: 0

README

goimage

A simple Go API library for transforming images

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GoldenCompare

func GoldenCompare(t *testing.T, buf []byte, filename string)

GoldenCompare checks the given buffer against the raw filename data. If the file doesn't exist, then the buffer is written out to the file.

func Process

func Process(buf []byte, options *Options) ([]byte, error)

Process takes any image processes it with the given options

Types

type AffineTransform

type AffineTransform struct {
	A            float64
	B            float64
	C            float64
	D            float64
	OffsetX      float64
	OffsetY      float64
	OffsetWidth  float64
	OffsetHeight float64
}

type CropStrategy

type CropStrategy int
const (
	CropStrategyEntropy CropStrategy = iota
	CropStrategyAttention
)

type Flip

type Flip int
const (
	FlipNone Flip = iota
	FlipX
	FlipY
	FlipXY
)

type GaussianBlur

type GaussianBlur struct {
	Sigma        float64
	MinAmplitude float64
}

type Gravity

type Gravity int
const (
	GravityCenter Gravity = iota
	GravityN
	GravityE
	GravityS
	GravityW
	GravithNE
	GravitySE
	GravitySW
	GravityNW
)

type HistogramOperation

type HistogramOperation int
const (
	HistogramOperationNone HistogramOperation = iota
	HistogramOperationCumulative
	HistogramOperationNormalize
)

type ImageFormat

type ImageFormat int
const (
	ImageFormatUnknown ImageFormat = iota
	ImageFormatBmp
	ImageFormatJpeg
	ImageFormatPng
	ImageFormatWebp
)

type Interpolator

type Interpolator int
const (
	InterpolatorDefault Interpolator = iota
	InterpolatorBicubic
	InterpolatorBilinear
	InterpolatorLBB
	InterpolatorNearestNeighbor
	InterpolatorNohalo
	InterpolatorVSQBS
)

type Kernel

type Kernel int
const (
	KernelDefault Kernel = iota
	KernelCubic
	KernelLanczos2
	KernelLanczos3
)

type Options

type Options struct {
	BackgroundColor    *RGBA
	CenterSampling     bool
	CropOffsetX        *ValueOption
	CropOffsetY        *ValueOption
	Flip               Flip
	Gamma              float64
	GaussianBlur       *GaussianBlur
	Gravity            Gravity
	Height             *ValueOption
	HistogramOperation HistogramOperation
	Interpolator       Interpolator
	Kernel             Kernel
	OutputFormat       ImageFormat
	PostFlip           int
	PostRotate         int
	Quality            int
	ResizeStrategy     ResizeStrategy
	Rotate             int
	Sharpen            *Sharpen
	Transform          *AffineTransform
	Width              *ValueOption
}

Options specifies how to process the input image

type RGBA

type RGBA struct {
	R byte
	G byte
	B byte
	A byte
}

func NewRGB

func NewRGB(red, green, blue int) RGBA

func NewRGBA

func NewRGBA(red, green, blue, alpha int) RGBA

type ResizeStrategy

type ResizeStrategy int
const (
	ResizeStrategyDefault ResizeStrategy = iota
	ResizeStrategyCrop
	ResizeStrategyMax
	ResizeStrategyMin
	ResizeStrategyPad
	ResizeStrategyStretch
)

type Sharpen

type Sharpen struct {
	Radius             float64
	FlatJaggyThreshold float64
	Brightening        float64
	Darkening          float64
	FlatSlope          float64
	JaggySlope         float64
}

type ValueOption

type ValueOption struct {
	// contains filtered or unexported fields
}

func NewValueOptionDouble

func NewValueOptionDouble(v float64) *ValueOption

func NewValueOptionInt

func NewValueOptionInt(v int) *ValueOption

func (*ValueOption) Double

func (t *ValueOption) Double() float64

func (*ValueOption) Int

func (t *ValueOption) Int() int

func (*ValueOption) IsDouble

func (t *ValueOption) IsDouble() bool

func (*ValueOption) IsInt

func (t *ValueOption) IsInt() bool

Jump to

Keyboard shortcuts

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