package smartcrop
import "github.com/muesli/smartcrop"
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 ¶
- Variables
- func SmartCrop(img image.Image, width, height int) (image.Rectangle, error)
- type Analyzer
- type Crop
- type CropSettings
- type Score
Variables ¶
var ( // ErrInvalidDimensions gets returned when the supplied dimensions are invalid ErrInvalidDimensions = errors.New("Expect either a height or width") )
Functions ¶
func SmartCrop ¶
SmartCrop applies the smartcrop algorithms on the the given image and returns the top crop or an error if something went wrong. This is still here for legacy/backwards-compat reasons
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 Crop ¶
Crop contains results
type CropSettings ¶
type CropSettings struct { InterpolationType resize.InterpolationFunction DebugMode bool Log *log.Logger }
CropSettings contains options to change cropping behaviour
type Score ¶
Score contains values that classify matches
Source Files ¶
- Version
- v0.2.0
- Published
- Aug 9, 2017
- Platform
- darwin/amd64
- Imports
- 13 packages
- Last checked
- 3 weeks ago –
Tools for package owners.