qoi

package module
v0.4.4 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2022 License: MIT Imports: 7 Imported by: 0

README

QOI - The “Quite OK Image” format for fast, lossless image compression - in Go

Fork of xfmoulet/qoi with changes to allow buffer reuse. See qoi.DecodeIntoBuffer(). The version in this repository will also:

  • omit the alpha channel if it is not present when decoding.
  • omit the alpha channel if it is not present or not used (all alpha values =100%) when encoding.
  • write un-premultiplied instead of premultiplied values. (in accordance with QOI specification)

See qoi.h for format specification.

More info at https://qoiformat.org/

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeConfig added in v0.4.0

func DecodeConfig(reader io.Reader) (cfg image.Config, err error)

func Encode

func Encode(w io.Writer, img image.Image) error

Encode encodes img as a QOI file and writes it to w.

Types

type Colorspace added in v0.4.0

type Colorspace uint8
const (
	SRGB   Colorspace = 0
	Linear Colorspace = 1
)
type Header struct {
	// contains filtered or unexported fields
}

func DecodeHeader

func DecodeHeader(r io.Reader) (header Header, err error)

DecodeHeader decodes only the header from the beginning of a QOI image and returns it, if it is valid.

type Image added in v0.4.0

type Image struct {
	Pix        []byte
	Width      int
	Height     int
	Channels   uint8
	Colorspace Colorspace
}

func Decode

func Decode(reader io.Reader) (*Image, error)

func DecodeIntoBuffer added in v0.4.0

func DecodeIntoBuffer(r io.Reader, dest []byte) (*Image, error)

Decode decodes QOI image data from r into dest, until all pixels are written. If dest cannot fit the image, an error is returned.

func (*Image) At added in v0.4.0

func (img *Image) At(x, y int) color.Color

func (*Image) Bounds added in v0.4.0

func (img *Image) Bounds() image.Rectangle

func (*Image) ColorModel added in v0.4.0

func (img *Image) ColorModel() color.Model

Jump to

Keyboard shortcuts

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