crop

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: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Crop

type Crop struct {
	Width  string `json:"width,omitempty"`
	Height string `json:"height,omitempty"`
	Anchor string `json:"anchor,omitempty"`
}

Crop produces a cropped image as rectangular region of a specific size.

func (Crop) Apply

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

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

type CropFactory

type CropFactory struct{}

CropFactory creates Crop instances.

func (CropFactory) Name

func (ff CropFactory) Name() string

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

func (CropFactory) New

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

New initialises and returns a configured Crop instance.

Syntax:

crop <width> <height> [<anchor>]

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.

anchor determines the anchor point of the rectangular region that is cut out. Possible values are: center, topleft, top, topright, left, right, bottomleft, bottom, bottomright. Default is center.

func (CropFactory) Unmarshal

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

Unmarshal decodes JSON data and returns a Crop instance.

Jump to

Keyboard shortcuts

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