pngquant

package
v0.1.1-0...-add34ea Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2019 License: MIT Imports: 5 Imported by: 1

Documentation

Index

Constants

View Source
const (
	SPEED_SLOWEST = 1
	SPEED_DEFAULT = 3
	SPEED_FASTEST = 10
)

Variables

View Source
var (
	ErrQualityTooLow      = errors.New("Quality too low")
	ErrValueOutOfRange    = errors.New("Value out of range")
	ErrOutOfMemory        = errors.New("Out of memory")
	ErrAborted            = errors.New("Aborted")
	ErrBitmapNotAvailable = errors.New("Bitmap not available")
	ErrBufferTooSmall     = errors.New("Buffer too small")
	ErrInvalidPointer     = errors.New("Invalid pointer")
	ErrUseAfterFree       = errors.New("Use after free")
)

Functions

func Compress

func Compress(img image.Image, quality int, speed int) (image.Image, error)

func GoImageToRgba32

func GoImageToRgba32(im image.Image) []byte

convert Go Image to RGBA32 bytes

func LibVersion

func LibVersion() string

func Rgb8PaletteToGoImage

func Rgb8PaletteToGoImage(w, h int, rgb8data []byte, pal color.Palette) image.Image

convert from RBG8 byte to Go Image

Types

type Attributes

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

func NewAttributes

func NewAttributes() (*Attributes, error)

Callers MUST call Release() on the returned object to free memory.

func (*Attributes) Release

func (a *Attributes) Release()

Free memory. Callers must not use this object after Release has been called.

func (*Attributes) SetQuality

func (a *Attributes) SetQuality(minQuality int, maxQuality int) error

func (*Attributes) SetSpeed

func (a *Attributes) SetSpeed(speed int) error

type Image

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

func NewImage

func NewImage(attr *Attributes, rgba32data []byte, width, height int, gamma float64) (*Image, error)

Callers MUST call Release() on the returned object to free memory.

func (*Image) Quantize

func (i *Image) Quantize(attr *Attributes) (*Result, error)

func (*Image) Release

func (i *Image) Release()

Free memory. Callers must not use i object after Release has been called.

type Result

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

Callers must not use i object once Release has been called on the parent Image struct.

func (*Result) GetImageHeight

func (r *Result) GetImageHeight() int

func (*Result) GetImageWidth

func (r *Result) GetImageWidth() int

func (*Result) GetPalette

func (r *Result) GetPalette() color.Palette

func (*Result) Release

func (r *Result) Release()

Free memory. Callers must not use i object after Release has been called.

func (*Result) WriteRemappedImage

func (r *Result) WriteRemappedImage() ([]byte, error)

Jump to

Keyboard shortcuts

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