imgutil

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 23, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const ColorRange = 0xffff // 16-bit color
View Source
const Epsilon = 1.0e-12

Variables

This section is empty.

Functions

func AppendHorizontally

func AppendHorizontally(img1 image.Image, img2 image.Image) image.Image

func ColorDepth

func ColorDepth(src image.Image) uint

func CropImage

func CropImage(src image.Image, rect image.Rectangle) image.Image

func FuzzFromPercent

func FuzzFromPercent(fp float64) float64

func GetRMSEDistortion

func GetRMSEDistortion(img1 image.Image, r image.Rectangle, img2 image.Image, sp image.Point) float64

func IsColorSimilar

func IsColorSimilar(u color.Color, v color.Color, fuzzP float64) bool

This function compares two colors within certain distance in a linear 3D color space. Two colors are similar when

fuzz >= sqrt(color_distance^2 * (u.a/qr) * (v.a/qr)  + (u.a - v.a)^2)

where

color_distance^2  = ((u.r-v.r)^2 + (u.g-v.g)^2 + (u.b-v.b)^2) / 3

See https://imagemagick.org/Usage/bugs/fuzz_distance/

func NewCanvasSameColor

func NewCanvasSameColor(src image.Image, r image.Rectangle) draw.Image

func ParseColorHex

func ParseColorHex(str string) (color.Color, error)

func QuantizeAndDither

func QuantizeAndDither(img image.Image, numColor int) *image.Paletted

func Resize

func Resize(src image.Image, size image.Point) image.Image

func Rotate

func Rotate(src image.Image, degree float64) image.Image

func SquaredDistortion

func SquaredDistortion(u color.Color, v color.Color) float64

func ToHexString

func ToHexString(c color.Color) string

func TransformToGrayColorModel

func TransformToGrayColorModel(img image.Image) image.Image

func TrimRect

func TrimRect(img image.Image, bgColor color.Color, fuzzP float64) (image.Rectangle, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL