smartcrop – github.com/muesli/smartcrop Index | Files | Directories

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

var (
	// ErrInvalidDimensions gets returned when the supplied dimensions are invalid
	ErrInvalidDimensions = errors.New("Expect either a height or width")
)

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(resizer options.Resizer) Analyzer

NewAnalyzer returns a new Analyzer using the given Resizer.

func NewAnalyzerWithLogger

func NewAnalyzerWithLogger(resizer options.Resizer, logger Logger) Analyzer

NewAnalyzerWithLogger returns a new analyzer with the given Resizer and Logger.

type Crop

type Crop struct {
	image.Rectangle
	Score Score
}

Crop contains results

type Logger

type Logger struct {
	DebugMode bool
	Log       *log.Logger
}

Logger contains a logger.

type Score

type Score struct {
	Detail     float64
	Saturation float64
	Skin       float64
}

Score contains values that classify matches

Source Files

debug.go smartcrop.go

Directories

PathSynopsis
nfnt
options
Version
v0.3.0 (latest)
Published
Oct 30, 2018
Platform
windows/amd64
Imports
13 packages
Last checked
2 weeks ago

Tools for package owners.