cutter.go
func (c Config) computeSize(bounds image.Rectangle, ratio image.Point) (p image.Point) {
	if c.Options&Ratio == Ratio {
		// Ratio option is on, so we take the biggest size available that fit the given ratio.
		if float64(ratio.X)/float64(bounds.Dx()) > float64(ratio.Y)/float64(bounds.Dy()) {
			p = image.Point{bounds.Dx(), (bounds.Dx() / ratio.X) * ratio.Y}
		} else {
			p = image.Point{(bounds.Dy() / ratio.Y) * ratio.X, bounds.Dy()}
		}
	} else {
		p = image.Point{ratio.X, ratio.Y}
	}
	return
}
func (c Config) computeSize(bounds image.Rectangle, ratio image.Point) (p image.Point) {
	if c.Options&Ratio == Ratio {
		// Ratio option is on, so we take the biggest size available that fit the given ratio.
		if float64(ratio.X)/float64(bounds.Dx()) > float64(ratio.Y)/float64(bounds.Dy()) {
			p = image.Point{bounds.Dx(), (bounds.Dx() / ratio.X) * ratio.Y}
		} else {
			p = image.Point{(bounds.Dy() / ratio.Y) * ratio.X, bounds.Dy()}
		}
	} else {
		p = image.Point{ratio.X, ratio.Y}
	}
	return
}
func ( c Config ) computeSize ( bounds image . Rectangle , ratio image . Point ) ( p image . Point ) { if c . Options & Ratio == Ratio { // Ratio option is on, so we take the biggest size available that fit the given ratio. if float64 ( ratio . X ) / float64 ( bounds . Dx ( ) ) > float64 ( ratio . Y ) / float64 ( bounds . Dy ( ) ) { p = image . Point { bounds . Dx ( ) , ( bounds . Dx ( ) / ratio . X ) * ratio . Y } } else { p = image . Point { ( bounds . Dy ( ) / ratio . Y ) * ratio . X , bounds . Dy ( ) } } } else { p = image . Point { ratio . X , ratio . Y } } return }
// computeSize retrieve the effective size of the cropped image.
// It is defined by Height, Width, and Ratio option.
computeSize retrieve the effective size of the cropped image . It is defined by Height Width and Ratio option .