heic

package module
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2026 License: MIT Imports: 13 Imported by: 11

README

heic

Status Go Reference

Go decoder for HEIC Image File Format (HEVC in HEIF).

Based on libheif and libde265 compiled to WASM and transpiled to pure Go with wasm2go (CGo-free).

The library will first try to use a dynamic/shared library (if installed) via purego and will fall back to the transpiled Go.

Build tags

  • nodynamic - do not use dynamic/shared library (use only WASM)

Documentation

Overview

Package heic implements an HEIC image decoder based on libheif/libde265 compiled to WASM.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMemRead  = errors.New("heic: mem read failed")
	ErrMemWrite = errors.New("heic: mem write failed")
	ErrDecode   = errors.New("heic: decode failed")
)

Errors .

View Source
var ForceWasmMode bool

ForceWasmMode, if true, forces using the WASM-based decoder even if a dynamic/shared library is available.

This exists mainly for testing purposes.

It is not safe to change this concurrently with any other use of this package.

Functions

func Decode

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

Decode reads a HEIC image from r and returns it as an image.Image.

func DecodeConfig

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

DecodeConfig returns the color model and dimensions of a HEIC image without decoding the entire image.

func Dynamic added in v0.2.1

func Dynamic() error

Dynamic returns error (if there was any) during opening dynamic/shared library.

Types

type Memory added in v0.5.0

type Memory = interface {
	Slice() *[]byte
	Grow(delta, max int64) int64
}

type Module added in v0.5.0

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

func New added in v0.5.0

func (*Module) X_initialize added in v0.5.0

func (m *Module) X_initialize()

func (*Module) Xdecode added in v0.5.0

func (m *Module) Xdecode(v0, v1, v2, v3, v4, v5, v6, v7, v8 int32) int32

func (*Module) Xfree added in v0.5.0

func (m *Module) Xfree(v0 int32)

func (*Module) Xmalloc added in v0.5.0

func (m *Module) Xmalloc(v0 int32) int32

func (*Module) Xmemory added in v0.5.0

func (m *Module) Xmemory() Memory

type Xwasi_snapshot_preview1 added in v0.5.0

type Xwasi_snapshot_preview1 = interface {
	Xenviron_get(v0, v1 int32) int32
	Xenviron_sizes_get(v0, v1 int32) int32
	Xfd_close(v0 int32) int32
	Xfd_fdstat_get(v0, v1 int32) int32
	Xfd_prestat_dir_name(v0, v1, v2 int32) int32
	Xfd_prestat_get(v0, v1 int32) int32
	Xfd_read(v0, v1, v2, v3 int32) int32
	Xfd_seek(v0 int32, v1 int64, v2, v3 int32) int32
	Xfd_write(v0, v1, v2, v3 int32) int32
	Xpath_unlink_file(v0, v1, v2 int32) int32
	Xproc_exit(v0 int32)
}

Jump to

Keyboard shortcuts

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