Documentation
¶
Overview ¶
Package encoder provides the encoder registration mechanisms for iv.
An encoder writes a decoded image to a writer, either as a file format (png, jpeg, webp) or as terminal graphics.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNotRegistered is returned when no encoder is registered under a name. ErrNotRegistered = errors.New("encoder not registered") // ErrUnsupportedFormat is returned when an encoder is registered but the // underlying library was not built with support for its output format. ErrUnsupportedFormat = errors.New("format not supported by this build") )
Functions ¶
func Unregister ¶
Unregister removes the named encoder. Returns whether it was registered. Not used by iv itself; provided for tests.
Types ¶
type EncodeFunc ¶
EncodeFunc encodes an image to a writer.
type Entry ¶
type Entry struct {
// Name is the unique encoder name.
Name string
// Desc is the human readable description.
Desc string
// Ext is the output file extension, without a leading dot. Empty for
// terminal encoders.
Ext string
// Term indicates the encoder writes terminal graphics rather than a file
// format.
Term bool
// contains filtered or unexported fields
}
Entry is a registered iv image encoder.
func TermEncoders ¶
func TermEncoders() []*Entry
TermEncoders returns the terminal graphics encoders, ordered by name.
type Option ¶
type Option func(*Entry)
Option is an encoder option.
func Encoder ¶
func Encoder(f EncodeFunc) Option
Encoder is an encoder option to set the encoding func.
func Extension ¶
Extension is an encoder option to set the output file extension, without a leading dot.
func ImageEncoder ¶
ImageEncoder is an encoder option setting the encoding func from a plain image encoder, such as [png.Encode].
Directories
¶
| Path | Synopsis |
|---|---|
|
Package all registers every iv encoder.
|
Package all registers every iv encoder. |
|
Package jpeg supplies a jpeg encoder for iv.
|
Package jpeg supplies a jpeg encoder for iv. |
|
Package nativewebp supplies a webp encoder for iv.
|
Package nativewebp supplies a webp encoder for iv. |
|
Package pdf supplies a pdf encoder for iv, wrapping any decoded image in a pdf document.
|
Package pdf supplies a pdf encoder for iv, wrapping any decoded image in a pdf document. |
|
Package png supplies a png encoder for iv.
|
Package png supplies a png encoder for iv. |
|
Package rasterm supplies the terminal graphics encoder for iv.
|
Package rasterm supplies the terminal graphics encoder for iv. |
|
Package vips supplies libvips backed encoders for iv, covering the output formats the Go encoders do not handle.
|
Package vips supplies libvips backed encoders for iv, covering the output formats the Go encoders do not handle. |