median

package
v0.0.0-...-92869c5 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2015 License: MIT, Apache-2.0 Imports: 7 Imported by: 0

README

Median

Basic median cut color quantization.

Documentation

Overview

Median implements basic median cut color quantization.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Quantizer

type Quantizer int

Quantizer methods implement median cut color quantization.

The value is the target number of colors. Methods do not require pointer receivers, simply construct Quantizer objects with a type conversion.

The type satisfies both quant.Quantizer and draw.Quantizer interfaces.

func (Quantizer) Image

func (q Quantizer) Image(img image.Image) *image.Paletted

Image performs color quantization and returns a paletted image.

Returned is a paletted image with no more than q colors. Note though that image.Paletted is limited to 256 colors.

func (Quantizer) Palette

func (q Quantizer) Palette(img image.Image) quant.Palette

Palette performs color quantization and returns a quant.Palette object.

Returned is a palette with no more than q colors. Q may be > 256.

func (Quantizer) Quantize

func (Quantizer) Quantize(p color.Palette, m image.Image) color.Palette

Quantize performs color quantization and returns a color.Palette.

Following the behavior documented with the draw.Quantizer interface, "Quantize appends up to cap(p) - len(p) colors to p and returns the updated palette...." This method does not limit the number of colors to 256. Cap(p) or the quantity cap(p) - len(p) may be > 256. Also for this method the value of the Quantizer object is ignored.

Jump to

Keyboard shortcuts

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