Documentation ¶
Index ¶
- func GetOrientation(r io.Reader) (int, io.Reader)
- type BildProcessor
- func (bp *BildProcessor) Blur(img image.Image, radius float64) image.Image
- func (bp *BildProcessor) Crop(img image.Image, width, height int, point processor.Point) image.Image
- func (bp *BildProcessor) Decode(data []byte) (image.Image, string, error)
- func (bp *BildProcessor) Encode(img image.Image, fmt string) ([]byte, error)
- func (bp *BildProcessor) FixOrientation(img image.Image, orientation int) image.Image
- func (bp *BildProcessor) Flip(img image.Image, mode string) image.Image
- func (bp *BildProcessor) GrayScale(img image.Image) image.Image
- func (bp *BildProcessor) Overlay(base []byte, overlays []*processor.OverlayAttrs) ([]byte, error)
- func (bp *BildProcessor) Resize(img image.Image, width, height int) image.Image
- func (bp *BildProcessor) Rotate(img image.Image, angle float64) image.Image
- func (bp *BildProcessor) Scale(img image.Image, width, height int) image.Image
- func (bp *BildProcessor) Watermark(base []byte, overlay []byte, opacity uint8) ([]byte, error)
- type Encoder
- type Encoders
- type EncodersOption
- type JpegEncoder
- type NopEncoder
- type PngEncoder
- type ProcessorOption
- type WebPEncoder
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BildProcessor ¶
type BildProcessor struct {
// contains filtered or unexported fields
}
BildProcessor uses bild library to process images using native Golang image.Image interface
func NewBildProcessor ¶
func NewBildProcessor(opts ...ProcessorOption) *BildProcessor
NewBildProcessor creates a new BildProcessor, if called without parameters encoders will be default
func (*BildProcessor) Blur ¶ added in v0.0.5
Blur takes an input image and blur radius and returns the Gausian blurred image
func (*BildProcessor) Crop ¶
func (bp *BildProcessor) Crop(img image.Image, width, height int, point processor.Point) image.Image
Crop takes an input image, width, height and a Point and returns the cropped image
func (*BildProcessor) Decode ¶ added in v0.0.3
Decode takes a byte array and returns the decoded image, format, or the error
func (*BildProcessor) Encode ¶ added in v0.0.3
Encode takes an image and the preferred format (extension) of the output Current supported format are "png", "jpg" and "jpeg"
func (*BildProcessor) FixOrientation ¶ added in v0.0.4
FixOrientation takes an image and it's EXIF orientation To get the orientation of the image see GetOrientation (exif.go)
func (*BildProcessor) Flip ¶ added in v0.0.4
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.
func (*BildProcessor) GrayScale ¶
func (bp *BildProcessor) GrayScale(img image.Image) image.Image
GrayScale takes an input image and returns the grayscaled image
func (*BildProcessor) Overlay ¶ added in v0.0.10
func (bp *BildProcessor) Overlay(base []byte, overlays []*processor.OverlayAttrs) ([]byte, error)
Overlay takes a base image and array of overlay images and returns the final overlayed image bytes or error
func (*BildProcessor) Resize ¶
Resize takes an input image, width and height and returns the re-sized image
func (*BildProcessor) Rotate ¶ added in v0.0.4
Rotate takes an input image and returns a image rotated by the specified degrees. The rotation is applied clockwise, and fractional angles are also supported.
type Encoder ¶ added in v0.0.3
Encoder is an interface to Encode image and return the encoded byte array or error
type Encoders ¶ added in v0.0.3
type Encoders struct {
// contains filtered or unexported fields
}
Encoders is a struct to store all supported encoders so that we don't have to create new encoder every time
func NewEncoders ¶ added in v0.0.3
func NewEncoders(opts ...EncodersOption) *Encoders
NewEncoders creates a new Encoders, if called without parameter (builder), all encoders option will be default
type EncodersOption ¶ added in v0.0.5
type EncodersOption func(*Encoders)
EncodersOption represents builder function for Encoders
func WithJpegEncoder ¶ added in v0.0.5
func WithJpegEncoder(jpegEncoder *JpegEncoder) EncodersOption
WithJpegEncoder is a builder function for setting custom JpegEncoder
func WithPngEncoder ¶ added in v0.0.5
func WithPngEncoder(pngEncoder *PngEncoder) EncodersOption
WithPngEncoder is a builder function for setting custom PngEncoder
func WithWebPEncoder ¶ added in v0.0.5
func WithWebPEncoder(webPEncoder *WebPEncoder) EncodersOption
WithWebPEncoder is a builder function for setting custom WebPEncoder
type JpegEncoder ¶ added in v0.0.3
JpegEncoder is an object to encode image to byte array with jpeg format
type NopEncoder ¶ added in v0.0.3
type NopEncoder struct{}
NopEncoder is a no-op encoder object for unsupported format and will return error
type PngEncoder ¶ added in v0.0.3
PngEncoder is an object to encode image to byte array with png format
type ProcessorOption ¶ added in v0.0.5
type ProcessorOption func(*BildProcessor)
ProcessorOption represents builder function for BildProcessor
func WithEncoders ¶ added in v0.0.5
func WithEncoders(encoders *Encoders) ProcessorOption
WithEncoders is a builder function to set custom Encoders for BildProcessor