Documentation ¶
Index ¶
- func ImageToGray(img image.Image) *image.Gray
- func InvertGray(gray *image.Gray) *image.Gray
- func LoadImage(path string) (image.Image, error)
- func SaveImagePNG(img image.Image, path string) error
- type AtkinsonDitherer
- type BurkesDitherer
- type DiffusionCell
- type DiffusionMask
- type Ditherer
- type FloydSteinbergDitherer
- type GridDitherer
- type ImportanceSampling
- type JarvisJudiceNinkeDitherer
- type Order2OrderedDitherer
- type Order3OrderedDitherer
- type Order4OrderedDitherer
- type Order8OrderedDitherer
- type Pattern
- type RandomThresholdDitherer
- type SierraDitherer
- type SierraLiteDitherer
- type StuckiDitherer
- type ThresholdDitherer
- type TwoRowSierraDitherer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ImageToGray ¶
ImageToGray converts an image.Image into an image.Gray.
func InvertGray ¶
InvertGray inverses the scale of a grayscale image by substracting each intensity to 255. Thus 0 (black) becomes 255 (white) and vice versa.
Types ¶
type AtkinsonDitherer ¶
type AtkinsonDitherer struct{}
AtkinsonDitherer implements Atkinson dithering.
type DiffusionCell ¶
type DiffusionCell struct {
// contains filtered or unexported fields
}
A DiffusionCell indicates a relative position and a diffusion intensity used for error diffusion.
type DiffusionMask ¶
type DiffusionMask struct {
// contains filtered or unexported fields
}
A DiffusionMask contains a slice of DiffusionCells and a normalization divisor.
type Ditherer ¶
A Ditherer convert a grayscale image with intensities going from 0 (black) to 255 (white) into a black and white image.
type FloydSteinbergDitherer ¶
type FloydSteinbergDitherer struct{}
FloydSteinbergDitherer implements Floyd-Steingberg dithering.
type GridDitherer ¶
type GridDitherer struct { K int // Size in pixels of a side of a cell Alpha float64 // Minimum desired number of points in a cell Beta float64 // Maximum desired number of points in a cell RNG *rand.Rand }
GridDitherer implements Bosch and Herman's grid-based method.
type ImportanceSampling ¶
type ImportanceSampling struct { N int // Number of points to sample Threshold uint8 // Threshold after which intensities are ignored (the threshold is not ignored) RNG *rand.Rand }
ImportanceSampling implements importance sampling.
type JarvisJudiceNinkeDitherer ¶
type JarvisJudiceNinkeDitherer struct{}
JarvisJudiceNinkeDitherer implements Jarvis-Judice-Ninke dithering.
type Order2OrderedDitherer ¶
type Order2OrderedDitherer struct{}
Order2OrderedDitherer implements order-2 ordered dithering.
type Order3OrderedDitherer ¶
type Order3OrderedDitherer struct{}
Order3OrderedDitherer implements order-3 ordered dithering.
type Order4OrderedDitherer ¶
type Order4OrderedDitherer struct{}
Order4OrderedDitherer implements order-4 ordered dithering.
type Order8OrderedDitherer ¶
type Order8OrderedDitherer struct{}
Order8OrderedDitherer implements order-8 ordered dithering.
type Pattern ¶
type Pattern [][]uint8
A Pattern is a matrix of threshold values used for ordered dithering.
type RandomThresholdDitherer ¶
RandomThresholdDitherer works the same way as ThresholdDitherer except that the threshold is randomly sampled for each pixel. This way some pixels are white when they would have been actually black.
type SierraLiteDitherer ¶
type SierraLiteDitherer struct{}
SierraLiteDitherer implements Sierra Lite dithering.
type ThresholdDitherer ¶
type ThresholdDitherer struct {
Threshold uint8
}
ThresholdDitherer converts each pixel in a grayscale image to black or white depending on the intensity of the pixel. If a pixel's intensity is above the given threshold then the pixel becomes white, else it becomes black.
type TwoRowSierraDitherer ¶
type TwoRowSierraDitherer struct{}
TwoRowSierraDitherer implements Two-row Sierra dithering.