filters

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2015 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Brightness

func Brightness(g *gift.GIFT, qsArgs []string) bool

Brightness creates a filter that changes the brightness of an image. The first (and only) parameter (percentage) must be in range (-100, 100). The percentage = 0 gives the original image. The percentage = -100 gives solid black image. The percentage = 100 gives solid white image.

func Contrast

func Contrast(g *gift.GIFT, qsArgs []string) bool

Contrast creates a filter that changes the contrast of an image. The first (and only) parameter (percentage) must be in range (-100, 100). The percentage = 0 gives the original image. The percentage = -100 gives solid grey image. The percentage = 100 gives an overcontrasted image.

func Crop

func Crop(g *gift.GIFT, qsArgs []string) bool

Crop will crop an image at the specified coords (x0, y0, x1, y1)

func FlipHorizontal

func FlipHorizontal(g *gift.GIFT, qsArgs []string) bool

FlipHorizontal creates a filter that flips an image horizontally.

func FlipVertical

func FlipVertical(g *gift.GIFT, qsArgs []string) bool

FlipVertical creates a filter that flips an image vertically.

func Hue

func Hue(g *gift.GIFT, qsArgs []string) bool

Hue creates a filter that rotates the hue of an image. The shift parameter is the hue angle shift, typically in range (-180, 180). The shift = 0 gives the original image.

func ParseFilters

func ParseFilters(q string) (*gift.GIFT, bool, error)

ProcessImage loads a file from storage, decodes it as an image, parses the query string, processes/filters the image and returns the result wrapped in a bytes.NewReader instance.

func Resize

func Resize(g *gift.GIFT, qsArgs []string) bool

Resize resizes the given image to the specified size with the configured resampling algorithm (defaults to lanczos).

func Rotate

func Rotate(g *gift.GIFT, qsArgs []string) bool

Rotate creates a filter that rotates an image by the given angle counter-clockwise. The angle parameter is the rotation angle in degrees. The only allowed values for this fuction are 90, 180 and 270

func Saturation

func Saturation(g *gift.GIFT, qsArgs []string) bool

Saturation creates a filter that changes the saturation of an image. The percentage parameter must be in range (-100, 500). The percentage = 0 gives the original image.

func Transpose

func Transpose(g *gift.GIFT, qsArgs []string) bool

Transpose creates a filter that flips an image horizontally and rotates 90 degrees counter-clockwise.

func Transverse

func Transverse(g *gift.GIFT, qsArgs []string) bool

Transverse creates a filter that flips an image vertically and rotates 90 degrees counter-clockwise.

Types

type Filter

type Filter func(*gift.GIFT, []string) bool

func GetFilter

func GetFilter(name string) (Filter, error)

GetFilter returns an appropriate Filter function for a given string.

type FilterArgs

type FilterArgs struct {
	Filter string
	Args   []string
}

func NewFilterArgs

func NewFilterArgs(filter, args string) *FilterArgs

type QueryString

type QueryString string

QueryString is a convenience wrapper designed to be wrapped around a url.RawQuery, providing ordered access to all key/value pairs.

func (*QueryString) Values

func (qs *QueryString) Values() ([]*FilterArgs, error)

Values returns a slice of *FilterArgs, each []string will have a length of 2 and will represent a single key/value pair parsed from the query string.

Jump to

Keyboard shortcuts

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