Documentation ¶
Index ¶
- Variables
- func AddBorder(img image.Image, size int, borderColor color.Color) *image.RGBA
- func AverageColor(img *image.Image) color.RGBA
- func AverageRGBA(color color.Color) uint8
- func CombineImages(imgs *Subimages) image.Image
- func ConvertToGray(input image.Image) *image.Gray
- func Crop(input image.Image, x0, y0, x1, y1 int) image.Image
- func GetColorPalette(img image.Image, numColors int) []color.RGBA
- func LoadImage(filename string) (image.Image, error)
- func Quantize(img image.Image, numColors int) image.Image
- func QuantizeKMeans(input image.Image, numColors int, dither bool) image.Image
- func RGBToHSL(r, g, b uint8) (float64, float64, float64)
- func Rotate(img image.Image, radians float64) image.Image
- func RotateDegrees(input image.Image, angle float64) image.Image
- func SaveImage(filename string, img image.Image) error
- func SortPixelsByHue(src image.Image) image.Image
- func Translate(input image.Image, dx, dy int) image.Image
- type Subimages
Constants ¶
This section is empty.
Variables ¶
var COLOR = struct { RED color.RGBA BLUE color.RGBA BLACK color.RGBA WHITE color.RGBA YELLOW color.RGBA ORANGE color.RGBA GREEN color.RGBA PURPLE color.RGBA PINK color.RGBA TRANSPARENT color.RGBA }{ RED: color.RGBA{255, 0, 0, 255}, BLUE: color.RGBA{0, 0, 255, 255}, BLACK: color.RGBA{0, 0, 0, 255}, WHITE: color.RGBA{255, 255, 255, 255}, YELLOW: color.RGBA{255, 255, 0, 255}, ORANGE: color.RGBA{255, 165, 0, 255}, GREEN: color.RGBA{0, 255, 0, 255}, PURPLE: color.RGBA{128, 0, 128, 255}, PINK: color.RGBA{255, 192, 203, 255}, TRANSPARENT: color.RGBA{0, 0, 0, 0}, }
Color constants
Functions ¶
func AverageRGBA ¶
Finds the average of the RGB values of a color
func CombineImages ¶
Takes in a subimages struct and combines them into a single image
func ConvertToGray ¶
Converts an image to grayscale
func Crop ¶
Returns a new image that is a sub-image of the input image. The bounds of the new image are (x0, y0, x1, y1). The point (x0, y0) is the top-left corner of the new image. The point (x1, y1) is the bottom-right corner of the new image.
func GetColorPalette ¶
Quantizes the image to the specified number of colors using the Median-cut algorithm. Returns a list of colors that represent the color palette of the image.
func QuantizeKMeans ¶
IMPORTANT NOTE! QuantizeKMeans is TERRIBLY OPTIMIZED, and NOT PERFORMANT AT ALL!! Do not use it for anything of actual importance, as it will likely take ages to run. However, the end result does look pretty cool, so I'm keeping it here for now.
func RotateDegrees ¶
Rotates the input image by the specified angle in degrees.
func SortPixelsByHue ¶
SortPixelsByHue sorts the pixels of the input image from left to right based on their hue and returns a new image.
Types ¶
type Subimages ¶
Represents a group of subimages that can be combined into a single image The subimages are arranged in a grid of size x by y.
func SplitImage ¶
Splits the image into a grid of smaller images. Returns a Subimages struct containing the smaller images and the arrangement of the grid. (x by y)