native

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CTNone     = 0
	CTYCbCr    = 1
	CTRCT      = 2
	CTFreeform = 3

	FrameBaseline   = 0
	FrameSequential = 1
	FrameLossless   = 3
	FrameJPEGLS     = 4

	LSInterleaveNone   = 0
	LSInterleaveLine   = 1
	LSInterleaveSample = 2
)

Variables

View Source
var ErrUnsupportedPlatform = errors.New("golibjpeg: no prebuilt native library for this platform")

ErrUnsupportedPlatform reports that this GOOS/GOARCH has no prebuilt native library, so nothing can be decoded or encoded. Every entry point wraps it, and the wrapped error names the platform. Test for it with errors.Is.

Functions

func Encode added in v1.2.0

func Encode(src []byte, params EncodeParams) ([]byte, error)

Types

type DecodeResult

type DecodeResult struct {
	Output     []byte
	Width      int
	Height     int
	Components int
	Precision  int
}

func Decode

func Decode(data []byte, colourTransform int) (*DecodeResult, error)

func DecodeToRGB

func DecodeToRGB(data []byte) (*DecodeResult, error)

type EncodeParams added in v1.2.0

type EncodeParams struct {
	Columns         int
	Rows            int
	SamplesPerPixel int
	BitsPerSample   int
	FrameType       int
	ColourTransform int
	Quality         int
	ErrorBound      int
	LSInterleaving  int
}

type ImageParams

type ImageParams struct {
	Width      int
	Height     int
	Components int
	Precision  int
}

func GetParameters

func GetParameters(data []byte) (*ImageParams, error)

type StatusError added in v1.1.0

type StatusError struct {
	Op     string
	Code   int
	Detail string
}

StatusError mirrors pylibjpeg-libjpeg RuntimeError messages.

Op already carries its own parentheses — "Decode()", "GetJPEGParameters()" — matching the names pylibjpeg puts in the same position, so the format strings below must not add another pair.

func (*StatusError) Error added in v1.1.0

func (e *StatusError) Error() string

Jump to

Keyboard shortcuts

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