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

Package Files

debug.go smartcrop.go

Variables

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

type Analyzer Uses

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 Uses

func NewAnalyzer(resizer options.Resizer) Analyzer

NewAnalyzer returns a new Analyzer using the given Resizer.

func NewAnalyzerWithLogger Uses

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

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

type Crop Uses

type Crop struct {
    image.Rectangle
    Score Score
}

Crop contains results

type Logger Uses

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

Logger contains a logger.

type Score Uses

type Score struct {
    Detail     float64
    Saturation float64
    Skin       float64
}

Score contains values that classify matches

Directories

PathSynopsis
nfnt
options

Package smartcrop imports 13 packages (graph) and is imported by 47 packages. Updated 2020-04-23. Refresh now. Tools for package owners.