pxl

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

README

Pxl

a package converts images to text

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ColorHex

func ColorHex(c color.Color) string

func Encode

func Encode(fg, bg color.Color, prevfg, prevbg *color.Color) (encoded string)

Encode converts a fg & bg colour into a formatted pair of 'pixels', using the prevfg & prevbg colours to perform something akin to run-length encoding

func FromFile

func FromFile(filename string) (encoded string, err error)

FromFile func is a convenience function that converts a file to a formatted string. See FromImage() for more details.

func FromImage

func FromImage(img image.Image) (encoded string, err error)

FromImage is the core function of `pxl`, It takes an image.Image and converts it to a string formatted for tview. The unicode half-block character (▀) with a fg & bg colour set will represent pixels in the returned string. Because each character represents two pixels, it is not possible to convert an

func FromImageGeneric

func FromImageGeneric(img image.Image) (encoded string, err error)

FromImageGeneric is the fallback function for processing images. It will be used for more exotic image formats than png or gif.

func FromNRGBA

func FromNRGBA(img *image.NRGBA) (encoded string, err error)

FromNRGBA saves a handful of μs when working with NRGBA images. These are what PNG24 images are decoded as.

func FromPaletted

func FromPaletted(img *image.Paletted) (encoded string, err error)

FromPaletted saves a few μs when working with paletted images. These are what PNG8 images are decoded as.

func FromReader

func FromReader(reader io.Reader) (encoded string, err error)

FromReader is a convenience function that converts an io.Reader to a formatted string.

Types

This section is empty.

Jump to

Keyboard shortcuts

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