halftone

package module
v0.0.0-...-f12247e Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2017 License: MIT Imports: 15 Imported by: 0

README

halftone

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnsupportedFormat = errors.New("imaging: unsupported image format")
)

Functions

func LoadImage

func LoadImage(filepath string) (image.Image, error)

Read and load an image from a file path.

func RgbaToGray

func RgbaToGray(img image.Image) *image.Gray

Create a new grayscale image from an rgba image.

Types

type ConvertFunc

type ConvertFunc func(color.Color) color.Gray

type Ditherer

type Ditherer interface {
	Run(gray *image.Gray) *image.Gray
}

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{}

func (FloydSteinbergDitherer) Run

func (dith FloydSteinbergDitherer) Run(gray *image.Gray) *image.Gray

type Format

type Format int
const (
	JPEG Format = iota
	PNG
	GIF
	TIFF
	BMP
)

func (Format) String

func (f Format) String() string

type GridDitherer

type GridDitherer struct {
	// contains filtered or unexported fields
}

GridDitherer implements Bosch and Herman's grid-based method.

func NewGridDitherer

func NewGridDitherer(cellSize int, a, b float64, rand *rand.Rand) GridDitherer

func (GridDitherer) Run

func (dith GridDitherer) Run(gray *image.Gray) *image.Gray

type ImageConverter

type ImageConverter struct {
}

func NewImageConverter

func NewImageConverter() *ImageConverter

func (*ImageConverter) ConvertToGray

func (ic *ImageConverter) ConvertToGray(m image.Image) *image.Gray

type ImageWorker

type ImageWorker struct {
}

func NewImageWorker

func NewImageWorker() *ImageWorker

creates a new instance of the image worker

func (*ImageWorker) GetImageDemensions

func (w *ImageWorker) GetImageDemensions(image image.Image) (int, int)

returns the image width and height

func (*ImageWorker) LoadImage

func (w *ImageWorker) LoadImage(path string) (image.Image, error)

loads an image from file

func (*ImageWorker) SaveImage

func (w *ImageWorker) SaveImage(path string, i image.Image)

Save image to file

type ThresholdDitherer

type ThresholdDitherer struct {
	// contains filtered or unexported fields
}

ThresholdDitherer converts each pixel in a grayscale image to black or white depending on the intensity of the pixel.

func NewThresholdDitherer

func NewThresholdDitherer(th uint8) ThresholdDitherer

func (ThresholdDitherer) Run

func (dith ThresholdDitherer) Run(gray *image.Gray) *image.Gray

Directories

Path Synopsis
cmd
halftone command

Jump to

Keyboard shortcuts

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