Help us shape the future of Go! Take the 2026 Go Developer Survey

goexiv

package module
v0.3.0-beta-1 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2025 License: MIT Imports: 3 Imported by: 0

README

Build Status

Go bindings for exiv2 (http://www.exiv2.org)

Those bindings are at the moment (very) incomplete, but already allow you to read the metadata of a file, and get the EXIF fields out of it. Binding coverage will be extended as I start needing more methods (or receiving more pull requests :) ).

Requirements

You need to have libexiv2 installed at version 0.26 at least.

Debian/Ubuntu
sudo apt install libexiv2-dev

Note: Because Exiv2 is a C++ library, you probably need Go 1.2 to benefit from the improved C++ support in CGO.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Error

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

Error represents an error including a code.

func (*Error) Code

func (e *Error) Code() int

Code returns the error code.

func (*Error) Error

func (e *Error) Error() string

type ExifData

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

ExifData wraps the respective C++ structure.

func (*ExifData) FindKey

func (d *ExifData) FindKey(key string) (*ExifDatum, error)

FindKey returns the Exif datum for the given key if present.

func (*ExifData) Iterator

func (d *ExifData) Iterator() *ExifDatumIterator

Iterator returns a new ExifDatumIterator to iterate over all Exif data.

type ExifDatum

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

ExifDatum wraps the respective C++ structure.

func (*ExifDatum) Key

func (d *ExifDatum) Key() string

Key returns the Exif key of the datum.

func (*ExifDatum) String

func (d *ExifDatum) String() string

type ExifDatumIterator

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

ExifDatumIterator wraps the respective C++ structure.

func (*ExifDatumIterator) HasNext

func (i *ExifDatumIterator) HasNext() bool

HasNext returns true as long as the iterator has another datum to deliver.

func (*ExifDatumIterator) Next

func (i *ExifDatumIterator) Next() *ExifDatum

Next returns the next ExifDatum of the iterator or nil if iterator has reached the end.

type Image

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

Image wraps the respective C++ structure.

func Open

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

Open opens an image file from the filesystem and returns a pointer to the corresponding Image object, but does not read the Metadata. Start the parsing with a call to ReadMetadata().

func OpenBytes

func OpenBytes(b []byte) (*Image, error)

OpenBytes opens a byte slice with image data and returns a pointer to the corresponding Image object, but does not read the Metadata. Start the parsing with a call to ReadMetadata().

func (*Image) GetExifData

func (i *Image) GetExifData() *ExifData

GetExifData returns the Exif data of the image.

func (*Image) GetIptcData

func (i *Image) GetIptcData() *IptcData

GetIptcData returns the IPTC data of the image.

func (*Image) GetXmpData

func (i *Image) GetXmpData() *XmpData

GetXmpData returns the XmpData of an Image.

func (*Image) ICCProfile

func (i *Image) ICCProfile() []byte

ICCProfile returns the ICC profile or nil if the image doesn't has one.

func (*Image) PixelHeight

func (i *Image) PixelHeight() int64

PixelHeight returns the height of the image in pixels.

func (*Image) PixelWidth

func (i *Image) PixelWidth() int64

PixelWidth returns the width of the image in pixels.

func (*Image) ReadMetadata

func (i *Image) ReadMetadata() error

ReadMetadata reads the metadata of an Image.

type IptcData

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

IptcData wraps the respective C++ structure.

func (*IptcData) FindKey

func (d *IptcData) FindKey(key string) (*IptcDatum, error)

FindKey returns the IPTC datum for the given key if present.

func (*IptcData) Iterator

func (d *IptcData) Iterator() *IptcDatumIterator

Iterator returns a new IptcDatumIterator to iterate over all IPTC data.

type IptcDatum

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

IptcDatum wraps the respective C++ structure.

func (*IptcDatum) Key

func (d *IptcDatum) Key() string

Key returns the IPTC key of the datum.

func (*IptcDatum) String

func (d *IptcDatum) String() string

type IptcDatumIterator

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

IptcDatumIterator wraps the respective C++ structure.

func (*IptcDatumIterator) HasNext

func (i *IptcDatumIterator) HasNext() bool

HasNext returns true as long as the iterator has another datum to deliver.

func (*IptcDatumIterator) Next

func (i *IptcDatumIterator) Next() *IptcDatum

Next returns the next IptcDatum of the iterator or nil if iterator has reached the end.

type XmpData

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

XmpData contains all Xmp Data of an image.

func (*XmpData) FindKey

func (d *XmpData) FindKey(key string) (*XmpDatum, error)

FindKey tries to find the specified key and returns its data. It returns an error if the key is invalid. If the key is not found, a nil pointer will be returned

type XmpDatum

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

XmpDatum stores the info of one xmp datum.

func (*XmpDatum) String

func (d *XmpDatum) String() string

Jump to

Keyboard shortcuts

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