image

package
v0.26.0 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package image provides API for decoding images.

Package is used internally by Pi, but it can also be used when writing unit tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Image

type Image struct {
	Width, Height int
	// Palette array is filled with black color (#000000)
	// if file has fewer colors than 256.
	Palette [256]RGB
	// Each pixel is a color from 0 to 255.
	// 0th element of slice represent pixel color in top-left corner.
	// 1st element is a next pixel on the right and so on.
	Pix []byte
}

Image contains information about decoded image.

func DecodePNG

func DecodePNG(reader io.Reader) (Image, error)

DecodePNG decodes PNG with indexed color mode. Such image must have at most 256 colors.

func (Image) String added in v0.22.0

func (i Image) String() string

String returns Image as string for debugging purposes.

type RGB

type RGB struct{ R, G, B byte }

RGB represents color

func (RGB) String

func (r RGB) String() string

Jump to

Keyboard shortcuts

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