cutter.go
func Crop(img image.Image, c Config) (image.Image, error) {
	maxBounds := c.maxBounds(img.Bounds())
	size := c.computeSize(maxBounds, image.Point{c.Width, c.Height})
	cr := c.computedCropArea(img.Bounds(), size)
	cr = img.Bounds().Intersect(cr)

	if c.Options&Copy == Copy {
		return cropWithCopy(img, cr)
	}
	if dImg, ok := img.(subImageSupported); ok {
		return dImg.SubImage(cr), nil
	}
	return cropWithCopy(img, cr)
}
func Crop(img image.Image, c Config) (image.Image, error) {
	maxBounds := c.maxBounds(img.Bounds())
	size := c.computeSize(maxBounds, image.Point{c.Width, c.Height})
	cr := c.computedCropArea(img.Bounds(), size)
	cr = img.Bounds().Intersect(cr)

	if c.Options&Copy == Copy {
		return cropWithCopy(img, cr)
	}
	if dImg, ok := img.(subImageSupported); ok {
		return dImg.SubImage(cr), nil
	}
	return cropWithCopy(img, cr)
}
func Crop ( img image . Image , c Config ) ( image . Image , error ) { maxBounds := c . maxBounds ( img . Bounds ( ) ) size := c . computeSize ( maxBounds , image . Point { c . Width , c . Height } ) cr := c . computedCropArea ( img . Bounds ( ) , size ) cr = img . Bounds ( ) . Intersect ( cr ) if c . Options & Copy == Copy { return cropWithCopy ( img , cr ) } if dImg , ok := img . ( subImageSupported ) ; ok { return dImg . SubImage ( cr ) , nil } return cropWithCopy ( img , cr ) }
// Crop retrieves an image that is a
// cropped copy of the original img.
//
// The crop is made given the informations provided in config.
Crop retrieves an image that is a cropped copy of the original img . The crop is made given the informations provided in config .