diff --git a/colorcrop.go b/colorcrop.go index 88595a1..a50d5fc 100644 --- a/colorcrop.go +++ b/colorcrop.go @@ -1,4 +1,5 @@ -// Go library for cropping images by removing borders with specified color. +// Package colorcrop is a Go library for cropping images by removing borders +// with specified color. package colorcrop import ( @@ -11,7 +12,7 @@ func Crop(img image.Image, color color.Color, thresold float64) image.Image { return CropWithComparator(img, color, thresold, CmpRGBComponentsDiff) } -// Crop returns cropped image with specified comparator. +// CropWithComparator returns cropped image with specified comparator. func CropWithComparator(img image.Image, color color.Color, thresold float64, comparator comparator) image.Image { return img.(interface { SubImage(r image.Rectangle) image.Image diff --git a/comparators.go b/comparators.go index f052973..db71c8e 100644 --- a/comparators.go +++ b/comparators.go @@ -9,7 +9,7 @@ import ( // range 0.0..1.0. type comparator func(color.Color, color.Color) float64 -// CmpColorDifference returns difference of two colors +// CmpSquareRGBComponentsDiff returns difference of two colors func CmpSquareRGBComponentsDiff(color1 color.Color, color2 color.Color) float64 { const maxDiff = 113509.94967402637 // Difference between black and white colors @@ -20,7 +20,7 @@ func CmpSquareRGBComponentsDiff(color1 color.Color, color2 color.Color) float64 math.Pow(float64(b2)-float64(b1), 2.0)) / maxDiff } -// CmpColorDifference returns difference of two colors. +// CmpRGBComponentsDiff returns difference of two colors. func CmpRGBComponentsDiff(color1 color.Color, color2 color.Color) float64 { const maxDiff = 765 // Difference between black and white colors