Documentation
¶
Overview ¶
Package images encodes images for a model to look at.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrPixelFormat = errors.New("images: unsupported pixel format")
ErrPixelFormat is returned for raw pixels in a format Encode cannot read.
var ErrPixelSize = errors.New("images: pixels do not match the image size")
ErrPixelSize is returned for raw pixels that do not fill the size given.
Functions ¶
func Channels ¶ added in v0.7.0
Channels is the number of bytes a pixel takes in a raw pixel format, or 0 for a format Resize cannot read. Empty is RGB.
func Encode ¶
Encode encodes an image for a model to look at, and returns the encoded bytes and their MIME type.
An image whose format is a MIME type is already encoded and keeps its bytes. Raw pixels are encoded as a JPEG, without their alpha channel: format is the pixel format, "RGB", "RGBA", "RGBX" or "L" (8-bit grey), and empty is RGB.
func Resize ¶ added in v0.7.0
Resize scales raw pixels to a new size with a bicubic filter, keeping their pixel format: "RGB", "RGBA", "RGBX" or "L" (8-bit grey), and empty is RGB.
The filter widens with the scale when shrinking, so every source pixel counts toward the result rather than the image being sampled at a few points.
Types ¶
This section is empty.