Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type OverlayAttrs ¶ added in v0.0.10
type Point ¶ added in v0.0.10
type Point int
Point specifies which focus point in the image should be considered while cropping
const ( // PointTopLeft crops an image with focus point at top-left PointTopLeft Point = 1 // PointTop crops an image with focus point at top PointTop Point = 2 // PointTopRight crops an image with focus point at top-right PointTopRight Point = 3 // PointLeft crops an image with focus point at left PointLeft Point = 4 // PointCenter crops an image with focus point at center PointCenter Point = 5 // PointRight crops an image with focus point at right PointRight Point = 6 // PointBottomLeft crops an image with focus point at bottom-left PointBottomLeft Point = 7 // PointBottom crops an image with focus point at bottom PointBottom Point = 8 // PointBottomRight crops an image with focus point at bottom-right PointBottomRight Point = 9 ExtensionWebP = "webp" ExtensionPNG = "png" ExtensionJPG = "jpg" ExtensionJPEG = "jpeg" )
type Processor ¶
type Processor interface { // Crop takes an image.Image, width, height and a Point and returns the cropped image Crop(image image.Image, width, height int, point Point) image.Image // Resize takes an image.Image, width and height and returns the re-sized image Resize(image image.Image, width, height int) image.Image // Scale takes an input image, width and height and returns the re-sized // image without maintaining the original aspect ratio Scale(image image.Image, width, height int) image.Image // GrayScale takes an input byte array and returns the grayscaled byte array or error GrayScale(image image.Image) image.Image // Blur takes an input byte array and returns the blurred byte array by the specified // radius(<=1000) or error radius must be larger than 0 Blur(image image.Image, radius float64) image.Image // Watermark takes an input byte array, overlay byte array and opacity value // and returns the watermarked image bytes or error Watermark(base []byte, overlay []byte, opacity uint8) ([]byte, error) // Flip takes an input image and returns the image flipped. The direction of flip // is determined by the specified mode - 'v' for a vertical flip, 'h' for a horizontal flip and // 'vh'(or 'hv') for both. Flip(image image.Image, mode string) image.Image // Rotate takes an input image and returns a image rotated by the specified degrees. // The rotation is applied clockwise, and fractional angles are supported. Rotate(image image.Image, angle float64) image.Image // Decode takes a byte array and returns the image, extension, and error Decode(data []byte) (img image.Image, format string, err error) // Encode takes an image and extension and return the encoded byte array or error Encode(img image.Image, format string) ([]byte, error) // FixOrientation takes an image and it's EXIF orientation (if exist) // and returns the image with its EXIF orientation fixed FixOrientation(img image.Image, orientation int) image.Image // Overlay takes an input byte array as the base image and // an array of OverlayAttrs to be placed as overlays to the base image Overlay(base []byte, overlays []*OverlayAttrs) ([]byte, error) }
Processor interface for performing operations on image bytes
Click to show internal directories.
Click to hide internal directories.