median

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2018 License: MIT Imports: 8 Imported by: 15

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) 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) Paletted

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

Paletted performs color quantization and returns a paletted image.

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

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