Documentation
¶
Index ¶
- Constants
- func CropBox(img image.Image, colorConverter ColorConverter, opts BoxOptions) image.Rectangle
- func CropImage(img image.Image, rect image.Rectangle) image.Image
- func DominantColorInRegion(img image.Image, region image.Rectangle, optTakeAvg ...bool) color.Color
- func FillImageRegionWithColor(img draw.Image, region image.Rectangle, col color.Color)
- func IsImageEqual(a, b image.Image) bool
- func Iterator(input image.Image) iter.Seq2[int, int]
- func MarginBox(bounds image.Rectangle, percentage float64) image.Rectangle
- func NewDrawFromImgColorModel(colorModel color.Model, bounds image.Rectangle) draw.Image
- func NormalizePixel[T Number](value T) uint8
- func RegionIterator(region image.Rectangle) iter.Seq2[int, int]
- func RotateImage(img image.Image, degrees RotationDegrees) image.Image
- type BoxOptions
- type ChannelHistogram
- type ColorConverter
- type DrawImageFactory
- type ImageHistogram
- type ImageOrientation
- type ImagePaletteDrawer
- type Margins
- type Number
- type RotationDegrees
Constants ¶
View Source
const ( MaxPixelValue = (1 << 8) - 1 MinPixelValue = 0 )
Variables ¶
This section is empty.
Functions ¶
func CropBox ¶
func CropBox(img image.Image, colorConverter ColorConverter, opts BoxOptions) image.Rectangle
CropBox calculates a bounding box for the given image by analyzing transparent pixels or minimum color values.
func DominantColorInRegion ¶
func DominantColorInRegion( img image.Image, region image.Rectangle, optTakeAvg ...bool, ) color.Color
DominantColorInRegion computes the average color in a region and returns the nearest color from the palette of that region.
func IsImageEqual ¶
IsImageEqual returns true if two images a and b are equal.
func NormalizePixel ¶
func RotateImage ¶
func RotateImage(img image.Image, degrees RotationDegrees) image.Image
RotateImage rotates the given image 90 degrees clockwise.
Types ¶
type BoxOptions ¶
type BoxOptions uint8
const ( BoxEliminateTransparent BoxOptions = 1 << iota BoxEliminateMinimumColor )
func (BoxOptions) Has ¶
func (bo BoxOptions) Has(opt BoxOptions) bool
type ChannelHistogram ¶
type ChannelHistogram [MaxPixelValue + 1]uint32
func ApplyCutoff ¶
func ApplyCutoff(histogram ChannelHistogram, cutoffLow, cutoffHigh float64) ChannelHistogram
ApplyCutoff modifies the histogram by cutting off a percentage of pixels at both low and high ends.
type DrawImageFactory ¶
type DrawImageFactory interface {
CreateDrawImage(colorModel color.Model, bounds image.Rectangle) draw.Image
}
func NewImageFactory ¶
func NewImageFactory(palette color.Palette) DrawImageFactory
type ImageHistogram ¶
type ImageHistogram struct {
// contains filtered or unexported fields
}
func CalculateHistogram ¶
func CalculateHistogram(img image.Image) ImageHistogram
CalculateHistogram calculates the histogram for each color channel in an image.
func (*ImageHistogram) Channel ¶
func (histogram *ImageHistogram) Channel(index uint8) ChannelHistogram
func (ImageHistogram) HiloHistogram ¶
func (histogram ImageHistogram) HiloHistogram() (minVal [3]uint8, maxVal [3]uint8)
func (*ImageHistogram) Set ¶
func (histogram *ImageHistogram) Set(index uint8, channel ChannelHistogram) bool
type ImageOrientation ¶
type ImageOrientation uint8
const ( OrientationPortrait ImageOrientation = iota OrientationLandscape )
func NewOrientation ¶
func NewOrientation(imgBounds image.Rectangle) ImageOrientation
type ImagePaletteDrawer ¶
type Margins ¶
type Margins[T comparable] struct { Top, Bottom, Left, Right T }
func (*Margins[T]) UpdateNonEmpty ¶
type RotationDegrees ¶
type RotationDegrees uint8
const ( Rotation90Degrees RotationDegrees = iota Rotation180Degrees Rotation270Degrees )
Source Files
¶
Click to show internal directories.
Click to hide internal directories.