Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddResizer ¶
func AddResizer(resizeType ResizeType, resizer Resizer)
AddResizer allows a custom resizer to use
func GetAvailableTypes ¶
func GetAvailableTypes() map[ResizeType]ResizeType
GetAvailableTypes returns all available types
func GetCustomResizers ¶
func GetCustomResizers() map[ResizeType]Resizer
GetCustomResizers returns a read only list of custom resizers
Types ¶
type Controller ¶
type Controller interface { Encode(target io.Writer) error Resize(resizeType ResizeType, width, height int) error Image() image.Image Format() string }
Controller lets you completely control one image
func NewController ¶
func NewController(data io.Reader, customResizers map[ResizeType]Resizer) (Controller, error)
NewController returns a new instance of a basic controller
type CropResizer ¶
type CropResizer struct { }
CropResizer scales the image down, and crops it to the given width and height
type FitResizer ¶
type FitResizer struct { }
FitResizer fits the original image into the given bounding box by keeping the original ratio
type PlainResizer ¶
type PlainResizer struct { }
PlainResizer resizes to the given width and height, regardless of the previous image properties
type ResizeType ¶
type ResizeType string
ResizeType defines which image manipulation will or can be used each ResizeType has its corresponding Resizer
const ( //TypeResize will either force the given sizes, or resize via original ratio when either height or width is not specified TypeResize ResizeType = "resize" //TypeCrop will generate an image with exact sizes, but only a part of the image is visible TypeCrop ResizeType = "crop" //TypeFit will resize the image according to the original ratio, but will not exceed the given bounds TypeFit ResizeType = "fit" )
Click to show internal directories.
Click to hide internal directories.