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 ¶
- Variables
- type BoxMeta
- type File
- type Item
- func (it *Item) HevcConfig() (b *bmff.ItemHevcConfigBox, ok bool)
- func (it *Item) Mirror() int
- func (item *Item) Reference(name string) *bmff.ItemReferenceEntry
- func (it *Item) Rotations() int
- func (it *Item) SpatialExtents() (width, height int, ok bool)
- func (it *Item) VisualDimensions() (width, height int, ok bool)
Constants ¶
This section is empty.
Variables ¶
var ErrNoEXIF = errors.New("heif: no EXIF found")
ErrNoEXIF is returned by File.EXIF when a file does not contain an EXIF item.
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
ItemData *bmff.ItemDataBox
ItemReference *bmff.ItemReferenceBox
}
BoxMeta contains the low-level BMFF metadata boxes.
func (*BoxMeta) EXIFItemID ¶
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 (*File) EXIF ¶
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) GetItemData ¶
GetItemData returns data specified by item's location
func (*File) ItemByID ¶
ItemByID by returns the file's Item of a given ID. If the ID is known, the returned error is ErrUnknownItem.
func (*File) PrimaryItem ¶
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
References []*bmff.ItemReferenceEntry
// contains filtered or unexported fields
}
Item represents an item in a HEIF file.
func (*Item) HevcConfig ¶
func (it *Item) HevcConfig() (b *bmff.ItemHevcConfigBox, ok bool)
HevcConfig returns the hvcC box
func (*Item) Rotations ¶
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 ¶
SpatialExtents returns the item's spatial extents property values, if present, not correcting from any camera rotation metadata.
func (*Item) VisualDimensions ¶
VisualDimensions returns the item's width and height after correcting for any rotations.