sixel

package module
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2022 License: MIT Imports: 10 Imported by: 40

README

go-sixel

DRCS Sixel Encoder/Decoder

Installation

$ go get github.com/mattn/go-sixel

You can install gosr (go sixel renderer), gosd (go sixel decoder) with following installation instruction.

$ go get github.com/mattn/go-sixel/cmd/gosr
$ go get github.com/mattn/go-sixel/cmd/gosd
Command Description
gosr Image renderer
gosd Decoder to png
goscat Render cats
gosgif Render animation GIF
gosl Run SL

Usage

Encode

$ cat foo.png | gosr -

Decode

$ cat foo.drcs | gosd > foo.png

Use as library

img, _, _ := image.Decode(filename)
sixel.NewEncoder(os.Stdout).Encode(img)

License

MIT

Author

Yasuhiro Matsumoto (a.k.a mattn)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Decoder

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

Decoder decode sixel format into image

func NewDecoder

func NewDecoder(r io.Reader) *Decoder

NewDecoder return new instance of Decoder

func (*Decoder) Decode

func (e *Decoder) Decode(img *image.Image) error

Decode do decoding from image

type Encoder

type Encoder struct {

	// Dither, if true, will dither the image when generating a paletted version
	// using the Floyd–Steinberg dithering algorithm.
	Dither bool

	// Width is the maximum width to draw to.
	Width int
	// Height is the maximum height to draw to.
	Height int

	// Colors sets the number of colors for the encoder to quantize if needed.
	// If the value is below 2 (e.g. the zero value), then 255 is used.
	// A color is always reserved for alpha, so 2 colors give you 1 color.
	Colors int
	// contains filtered or unexported fields
}

Encoder encode image to sixel format

func NewEncoder

func NewEncoder(w io.Writer) *Encoder

NewEncoder return new instance of Encoder

func (*Encoder) Encode

func (e *Encoder) Encode(img image.Image) error

Encode do encoding

Directories

Path Synopsis
cmd
gosr Module

Jump to

Keyboard shortcuts

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