smartcrop

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Smartcrop

type Smartcrop struct {
	Width  string `json:"width,omitempty"`
	Height string `json:"height,omitempty"`
}

Smartcrop finds good rectangular image crops of a specific size. It uses https://github.com/muesli/smartcrop

func (Smartcrop) Apply

func (f Smartcrop) Apply(repl *caddy.Replacer, img image.Image) (image.Image, error)

Apply applies the image filter to an image and returns the new image.

type SmartcropFactory

type SmartcropFactory struct{}

SmartcropFactory creates Crop instances.

func (SmartcropFactory) Name

func (ff SmartcropFactory) Name() string

Name returns the name of the filter, which is also the directive used in the image filter block.

func (SmartcropFactory) New

func (ff SmartcropFactory) New(args ...string) (imagefilter.Filter, error)

New initialises and returns a configured Smartcrop instance.

Syntax:

smartcrop <width> <height>

Parameters:

width must be a positive integer and determines the width of the cropped image.

height must be a positive integer and determines the height of the cropped image.

func (SmartcropFactory) Unmarshal

func (ff SmartcropFactory) Unmarshal(data []byte) (imagefilter.Filter, error)

Unmarshal decodes JSON data and returns a Smartcrop instance.

Jump to

Keyboard shortcuts

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