Documentation ¶
Overview ¶
Package smartcrop implements a content aware image cropping library based on Jonas Wagner's smartcrop.js https://github.com/jwagner/smartcrop.js
Package smartcrop implements a content aware image cropping library based on Jonas Wagner's smartcrop.js https://github.com/jwagner/smartcrop.js
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrInvalidDimensions gets returned when the supplied dimensions are invalid ErrInvalidDimensions = errors.New("Expect either a height or width") )
Functions ¶
Types ¶
type Analyzer ¶
type Analyzer interface {
FindBestCrop(img image.Image, width, height int) (image.Rectangle, error)
}
Analyzer interface analyzes its struct and returns the best possible crop with the given width and height returns an error if invalid
func NewAnalyzer ¶
func NewAnalyzer() Analyzer
NewAnalyzer returns a new analyzer with default settings
func NewAnalyzerWithCropSettings ¶
func NewAnalyzerWithCropSettings(cropSettings CropSettings) Analyzer
NewAnalyzerWithCropSettings returns a new analyzer with the given settings
type CropSettings ¶
type CropSettings struct { InterpolationType resize.InterpolationFunction DebugMode bool Log *log.Logger }
CropSettings contains options to change cropping behaviour
Click to show internal directories.
Click to hide internal directories.