exif

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2026 License: Apache-2.0 Imports: 12 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 (
	TIFFNamespace = "tiff"
	EXIFNamespace = "exif"
)

The namespaces of the tags of EXIF metadata, which are those of their XMP schemas: tiff for the tags of the image, from IFD0 and IFD1, and exif for those of the photo, its GPS position, and interoperability. This file doesn't need cgo, so they're defined without it.

Variables

This section is empty.

Functions

This section is empty.

Types

type EXIF

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

func Open

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

func Parse

func Parse(data []byte) (*EXIF, error)

Parse returns the EXIF data in the data, which is a JPEG image, or EXIF data, or the EXIF data of a HEIF image, which is after four bytes of the offset of its TIFF header, or an error when there are no tags in it

func Read

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

func (*EXIF) Close

func (e *EXIF) Close() error

func (*EXIF) MakerNote

func (e *EXIF) MakerNote() *MakerNote

func (*EXIF) MarshalJSON

func (e *EXIF) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (*EXIF) Orientation

func (e *EXIF) Orientation() int

Orientation returns the orientation of the image, from 1 to 8, as EXIF defines it, or 1 when it doesn't have one (see tiff.Orientation)

func (*EXIF) Tags

func (e *EXIF) Tags() []*Tag

func (*EXIF) Thumbnail

func (e *EXIF) Thumbnail() []byte

Thumbnail returns the thumbnail which is embedded in the EXIF data, which is usually a small JPEG image, such as 160x120, or nil when there isn't one (see tiff.Thumbnail). libexif reads the thumbnail, but doesn't expose it, or keep the tags of where it is, so they're read from the data.

type IFD

type IFD uint

IFD identifies which Image File Directory an entry belongs to.

type MakerNote

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

func (*MakerNote) MarshalJSON

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

MarshalJSON implements json.Marshaler.

type Tag

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

func (*Tag) Any

func (t *Tag) Any() any

Any returns the tag's data decoded into an appropriate Go type (implements metadata.Metadata). For single-component tags: uint8, int8, uint16, int16, uint32, int32, rational.Rational (signed or unsigned), float32, float64, or string (ASCII). For multi-component tags the corresponding slice type is returned. UNDEFINED format is returned as []byte.

func (*Tag) Bytes

func (t *Tag) Bytes() []byte

Bytes returns nil for EXIF tags (implements metadata.Metadata).

func (*Tag) Components

func (t *Tag) Components() uint

Components returns the number of values in the tag's data array.

func (*Tag) Format

func (t *Tag) Format() libexif.Format

Format returns the EXIF data format of the tag.

func (*Tag) IFD

func (t *Tag) IFD() IFD

IFD returns which Image File Directory this tag belongs to.

func (*Tag) Image

func (t *Tag) Image() image.Image

Image returns nil for EXIF tags (implements metadata.Metadata).

func (*Tag) Key

func (t *Tag) Key() string

Key returns the tag name, such as "DateTimeOriginal" (implements metadata.Metadata).

func (*Tag) MarshalJSON

func (t *Tag) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (*Tag) NS

func (t *Tag) NS() string

NS returns "tiff" for IFD0/IFD1 tags and "exif" for EXIF/GPS/Interop tags (implements metadata.Metadata). The namespace aligns with XMP namespace conventions so cross-source lookups work uniformly.

func (*Tag) Name

func (t *Tag) Name() string

Name returns the tag name with its namespace, such as "exif:DateTimeOriginal".

func (*Tag) String

func (t *Tag) String() string

String implements fmt.Stringer.

func (*Tag) Tag

func (t *Tag) Tag() TagType

Tag returns the numeric tag identifier.

func (*Tag) Value

func (t *Tag) Value() string

Value returns the libexif-formatted string representation of the tag value (implements metadata.Metadata).

type TagType

type TagType uint

TagType is the numeric EXIF tag identifier.

Jump to

Keyboard shortcuts

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