Documentation ¶
Index ¶
- Constants
- Variables
- func ReadFile(path string) (img.Image, error)
- func WriteFile(_img img.Image, path, filename string) error
- type CropRectangle
- type Image
- type Monochrome
- func (p *Monochrome) At(x, y int) color.Color
- func (p *Monochrome) Bounds() img.Rectangle
- func (p *Monochrome) ColorModel() color.Model
- func (p *Monochrome) Crop(minX, minY, maxX, maxY int) img.Image
- func (p *Monochrome) Histogram(vertical bool) []uint16
- func (p *Monochrome) Inverse()
- func (p *Monochrome) PixOffset(x, y int) int
- func (p *Monochrome) Set(x, y int, c color.Color)
- func (p *Monochrome) SubImage(r img.Rectangle) img.Image
- type MonochromeColor
Constants ¶
const ( Black uint8 = 0 White uint8 = 255 )
Monochrome color is either a black or white. 0 = White 255 = Black
Variables ¶
var MonochromeModel color.Model = color.ModelFunc(monochromeModel)
MonochromeModel for the color of black and white type.
Functions ¶
Types ¶
type CropRectangle ¶ added in v0.7.0
type Image ¶
Image is a data struct which embeds Go standard image library.
func (*Image) Base64 ¶
Base64 encodes an image that has been decoded previously through New function. The string returned is a base64 format of the given image.
func (*Image) Monochrome ¶ added in v0.4.0
func (p *Image) Monochrome(threshold uint8, inverse bool) *Monochrome
Monochrome converts registered image from New function and returns Monochrome type image.
type Monochrome ¶ added in v0.2.0
type Monochrome struct { // Pix holds the image's pixels, as gray values. The pixel at // (x, y) starts at Pix[(y-Rect.Min.Y)*Stride + (x-Rect.Min.X)*1]. Pix []uint8 // Stride is the Pix stride (in bytes) between vertically adjacent pixels. Stride int // Rect is the image's bounds. Rect img.Rectangle // Threshold is the value which determines black / white pixel Threshold uint8 // contains filtered or unexported fields }
Monochrome is an in-memory image whose At method returns color.Monochrome values.
func NewMonochrome ¶ added in v0.2.0
func NewMonochrome(r img.Rectangle, threshold uint8) *Monochrome
NewMonochrome returns a new Monochrome image with the given bounds.
func (*Monochrome) At ¶ added in v0.2.0
func (p *Monochrome) At(x, y int) color.Color
At returns pixel color of the image at (x,y) coordinate point.
func (*Monochrome) Bounds ¶ added in v0.2.0
func (p *Monochrome) Bounds() img.Rectangle
Bounds returns rectangle boundary of the image.
func (*Monochrome) ColorModel ¶ added in v0.2.0
func (p *Monochrome) ColorModel() color.Model
ColorModel returns the MonochromeModel color type.
func (*Monochrome) Crop ¶ added in v0.7.0
func (p *Monochrome) Crop(minX, minY, maxX, maxY int) img.Image
func (*Monochrome) Histogram ¶ added in v0.3.0
func (p *Monochrome) Histogram(vertical bool) []uint16
Histogram returns array of data from registered Monochrome image type vertical = false, horizontal axis profile vertical = true, vertical axis profile
func (*Monochrome) Inverse ¶ added in v0.9.0
func (p *Monochrome) Inverse()
Inverse set [inverse] parameter to true
func (*Monochrome) PixOffset ¶ added in v0.2.0
func (p *Monochrome) PixOffset(x, y int) int
PixOffset returns the index of the first element of Pix that corresponds to the pixel at (x, y).
func (*Monochrome) Set ¶ added in v0.2.0
func (p *Monochrome) Set(x, y int, c color.Color)
Set determines black or white pixel color at (x,y) coordinate point by comparing given MonochromeColor model value to defined threshold value.
type MonochromeColor ¶ added in v0.2.0
type MonochromeColor struct {
Y uint8
}
MonochromeColor represents a 1-bit color.
func (MonochromeColor) RGBA ¶ added in v0.2.0
func (c MonochromeColor) RGBA() (r, g, b, a uint32)
RGBA returns the RGBA values of MonochromeColor type.