gojxl

package module
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2023 License: MIT Imports: 7 Imported by: 0

README

go-jxl-decode

A Golang wrapper for libjxl.

Building

On Windows, download the latest release of libjxl and extract the DLLs to the same directory as your application. You need all of them.

After building, the application might be statically linked? I'm not sure about that but it seems to be the case.

On Linux, install libbrotli-dev and, if your distro has it, libjxl-dev. (If not, get the package from the above link.)

Usage

This library registers itself with image and additionally exports Decode, DecodeConfig and Encode, which work as you might expect. For more complex usage, such as multi-frame JXLs, use the JxlEncoder and JxlDecoder objects.

Note that only Gray, RGBA, and NRGBA color models and their 16-bit counterparts are identitifed by the library.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decode

func Decode(r io.Reader) (image.Image, error)

func DecodeConfig

func DecodeConfig(r io.Reader) (image.Config, error)

func Encode added in v1.2.0

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

Types

type DecodeError added in v1.2.0

type DecodeError string
const DecodeDataError DecodeError = "invalid body"
const DecodeHeaderError DecodeError = "invalid header"
const DecodeInputError DecodeError = "unable to set input"

func (DecodeError) Error added in v1.2.0

func (e DecodeError) Error() string

type EncodeError added in v1.2.0

type EncodeError string
const EncodeClosedError EncodeError = "encoder is closed"
const EncodeDataError EncodeError = "unknown"
const EncodeInfoError EncodeError = "failed to set info"
const EncodeInputError EncodeError = "failed to set input"
const EncodeUninitializedError EncodeError = "info not set before writing"
const EncodeUnsupportedError EncodeError = "image type not supported"

func (EncodeError) Error added in v1.2.0

func (e EncodeError) Error() string

type JxlDecoder added in v1.1.0

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

func NewJxlDecoder added in v1.1.0

func NewJxlDecoder(r io.Reader) *JxlDecoder

func (*JxlDecoder) Destroy added in v1.1.0

func (d *JxlDecoder) Destroy()

func (*JxlDecoder) FrameDuration added in v1.2.1

func (d *JxlDecoder) FrameDuration() time.Duration

func (*JxlDecoder) Info added in v1.1.0

func (d *JxlDecoder) Info() (JxlInfo, error)

func (*JxlDecoder) Read added in v1.1.0

func (d *JxlDecoder) Read() ([]byte, error)

func (*JxlDecoder) Reset added in v1.1.0

func (d *JxlDecoder) Reset(r io.Reader)

func (*JxlDecoder) Rewind added in v1.1.0

func (d *JxlDecoder) Rewind()

type JxlEncoder added in v1.2.0

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

func NewJxlEncoder added in v1.2.0

func NewJxlEncoder(w io.Writer) *JxlEncoder

func (*JxlEncoder) Destroy added in v1.2.0

func (e *JxlEncoder) Destroy()

func (*JxlEncoder) NextIsLast added in v1.2.0

func (e *JxlEncoder) NextIsLast()

func (*JxlEncoder) SetInfo added in v1.2.0

func (e *JxlEncoder) SetInfo(x, y int, m color.Model, fps float64) bool

func (*JxlEncoder) Write added in v1.2.0

func (e *JxlEncoder) Write(b []byte) error

type JxlInfo added in v1.1.0

type JxlInfo struct {
	H, W               int
	BitDepth           int
	Channels           int
	Alpha              int
	AlphaPremult       bool
	Orientation        int
	PreviewH, PreviewW int
	Animated           bool
}

Jump to

Keyboard shortcuts

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