heif

package
v0.0.0-...-2148625 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2023 License: Apache-2.0 Imports: 5 Imported by: 12

Documentation

Overview

Package heif reads HEIF containers, as found in Apple HEIC/HEVC images. This package does not decode images; it only reads the metadata.

This package is a work in progress and makes no API compatibility promises.

Index

Constants

This section is empty.

Variables

View Source
var ErrNoEXIF = errors.New("heif: no EXIF found")

ErrNoEXIF is returned by File.EXIF when a file does not contain an EXIF item.

View Source
var ErrUnknownItem = errors.New("heif: unknown item")

ErrUnknownItem is returned by File.ItemByID for unknown items.

Functions

This section is empty.

Types

type BoxMeta

type BoxMeta struct {
	FileType     *bmff.FileTypeBox
	Handler      *bmff.HandlerBox
	PrimaryItem  *bmff.PrimaryItemBox
	ItemInfo     *bmff.ItemInfoBox
	Properties   *bmff.ItemPropertiesBox
	ItemLocation *bmff.ItemLocationBox
}

BoxMeta contains the low-level BMFF metadata boxes.

func (*BoxMeta) EXIFItemID

func (m *BoxMeta) EXIFItemID() uint32

EXIFItemID returns the item ID of the EXIF part, or 0 if not found.

type File

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

File represents a HEIF file.

Methods on File should not be called concurrently.

func Open

func Open(f io.ReaderAt) *File

Open returns a handle to access a HEIF file.

func (*File) EXIF

func (f *File) EXIF() ([]byte, error)

EXIF returns the raw EXIF data from the file. The error is ErrNoEXIF if the file did not contain EXIF.

The raw EXIF data can be parsed by the github.com/rwcarlsen/goexif/exif package's Decode function.

func (*File) ItemByID

func (f *File) ItemByID(id uint32) (*Item, error)

ItemByID by returns the file's Item of a given ID. If the ID is known, the returned error is ErrUnknownItem.

func (*File) PrimaryItem

func (f *File) PrimaryItem() (*Item, error)

PrimaryItem returns the HEIF file's primary item.

type Item

type Item struct {
	ID         uint32
	Info       *bmff.ItemInfoEntry
	Location   *bmff.ItemLocationBoxEntry // location in file
	Properties []bmff.Box
	// contains filtered or unexported fields
}

Item represents an item in a HEIF file.

func (*Item) Rotations

func (it *Item) Rotations() int

Rotations returns the number of 90 degree rotations counter-clockwise that this image should be rendered at, in the range [0,3].

func (*Item) SpatialExtents

func (it *Item) SpatialExtents() (width, height int, ok bool)

SpatialExtents returns the item's spatial extents property values, if present, not correcting from any camera rotation metadata.

func (*Item) VisualDimensions

func (it *Item) VisualDimensions() (width, height int, ok bool)

VisualDimensions returns the item's width and height after correcting for any rotations.

Directories

Path Synopsis
Package bmff reads ISO BMFF boxes, as used by HEIF, etc.
Package bmff reads ISO BMFF boxes, as used by HEIF, etc.
The dumpheif program dumps the structure and metadata of a HEIF file.
The dumpheif program dumps the structure and metadata of a HEIF file.

Jump to

Keyboard shortcuts

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