func ScaleImageDown(src image.Image, resizeArea uint64, scaler draw.Scaler) image.Image {
	if resizeArea > 0 && scaler != nil {
		imageSize := src.Bounds().Size()
		imageArea := uint64(imageSize.X * imageSize.Y)
		if imageArea > resizeArea {
			scaleRatio := math.Sqrt(float64(resizeArea) / float64(imageArea))
			scaled := image.NewNRGBA(image.Rect(0, 0, int(math.Floor(float64(imageSize.X)*scaleRatio)), int(math.Floor(float64(imageSize.Y)*scaleRatio))))
			scaler.Scale(scaled, scaled.Bounds(), src, src.Bounds(), draw.Src, nil)
			return scaled
		}
	}
	return src
}
ScaleImageDown will scale the image down as needed.  This is relatively slow.
package vibrant
import (
	"golang.org/x/image/draw"
	"image"
	"math"
)
func clampFloat64(value, min, max float64) float64 {
	if value < min {
		return min
	}
	if value > max {
		return max
	}
	return value
}
func clampUint8(value, min, max uint8) uint8 {
	if value < min {
		return min
	}
	if value > max {
		return max
	}
	return value
}
func roundFloat64(value float64) float64 {
	if value < 0.0 {
		return value - 0.5
	}
	return value + 0.5
}
type SubImager interface {
	SubImage(r image.Rectangle) image.Image
}