goexiv

package module
v0.0.0-...-22ef0e9 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2020 License: MIT Imports: 4 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, get the EXIF fields out of it, and add EXIF/IPTC string fields. 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.27 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
}

func (*Error) Code

func (e *Error) Code() int

func (*Error) Error

func (e *Error) Error() string

type ExifData

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

func (*ExifData) FindKey

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

func (*ExifData) GetString

func (d *ExifData) GetString(key string) (string, error)

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
}

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
}

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

func (*Image) GetIptcData

func (i *Image) GetIptcData() *IptcData

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

func (*Image) SetExifString

func (i *Image) SetExifString(key, value string) error

func (*Image) SetIptcString

func (i *Image) SetIptcString(key, value string) error

func (*Image) SetMetadataString

func (i *Image) SetMetadataString(format, key, value string) error

Sets an exif or iptc key with a given string value

type IptcData

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

func (*IptcData) FindKey

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

func (*IptcData) GetString

func (d *IptcData) GetString(key string) (string, error)

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
}

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 MetadataProvider

type MetadataProvider interface {
	GetString(key string) (string, error)
}

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