heif

package
v1.1.11 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2026 License: Apache-2.0 Imports: 13 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	// Namespace is the namespace of the metadata blocks of a HEIF image which
	// aren't EXIF or XMP data
	Namespace = "heif"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type HEIF

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

HEIF wraps a libheif context and exposes the primary image as an image.Image. The primary image is decoded when its pixels are first read, with At or Primary, so its size, color model, metadata and thumbnails are read without decoding it.

func Open

func Open(path string) (*HEIF, error)

Open opens a HEIF image by path and decodes its primary image.

func Parse

func Parse(buf []byte) (*HEIF, error)

Parse opens a HEIF image from a byte slice and decodes its primary image.

func Read

func Read(r io.Reader) (*HEIF, error)

Read opens a HEIF image from a reader and decodes its primary image.

func (*HEIF) At

func (h *HEIF) At(x, y int) color.Color

At returns the color of the pixel at x, y in the primary image, which is decoded when it hasn't been.

func (*HEIF) Bounds

func (h *HEIF) Bounds() image.Rectangle

Bounds returns the bounds of the primary image, without decoding it.

func (*HEIF) Close

func (h *HEIF) Close() error

Close releases the underlying libheif resources.

func (*HEIF) ColorModel

func (h *HEIF) ColorModel() color.Model

ColorModel returns the color model of the primary image, without decoding it.

func (*HEIF) Decode

func (h *HEIF) Decode() (image.Image, error)

Decode returns the decoded primary image, which is decoded when it hasn't been, or an error when it can't be decoded.

func (*HEIF) Metadata

func (h *HEIF) Metadata() []metadata.Metadata

Metadata returns metadata from the primary image.

EXIF and XMP payloads are parsed and expanded into their structured metadata entries. Any remaining blocks are returned as generic HEIF metadata records.

func (*HEIF) Primary

func (h *HEIF) Primary() image.Image

Primary returns the decoded primary image, which is decoded when it hasn't been, or nil when it can't be decoded (see Decode).

func (*HEIF) Thumbnails

func (h *HEIF) Thumbnails() []image.Image

Thumbnails returns any attached thumbnail images for the primary image.

func (*HEIF) XMP

func (h *HEIF) XMP() *xmp.XMP

XMP returns the parsed XMP document from the primary image, if present.

type Meta

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

func (*Meta) Any

func (m *Meta) Any() any

func (*Meta) Bytes

func (m *Meta) Bytes() []byte

func (*Meta) Image

func (m *Meta) Image() image.Image

func (*Meta) Key

func (m *Meta) Key() string

func (*Meta) MarshalJSON

func (m *Meta) MarshalJSON() ([]byte, error)

func (*Meta) NS

func (m *Meta) NS() string

func (*Meta) Value

func (m *Meta) Value() string

Jump to

Keyboard shortcuts

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