exif

package
v0.0.0-...-1f36970 Latest Latest
Warning

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

Go to latest
Published: May 13, 2020 License: BSD-2-Clause Imports: 5 Imported by: 5

Documentation

Index

Constants

View Source
const (
	TypeByteSize           = 1
	TypeASCIISize          = 1
	TypeASCIINoNulSize     = 1
	TypeShortSize          = 2
	TypeLongSize           = 4
	TypeRationalSize       = 8
	TypeSignedLongSize     = 4
	TypeSignedRationalSize = 8
)

Tag sizes

Variables

View Source
var (
	// ErrNotEnoughData is used when there isn't enough data to accomodate what
	// we're trying to parse (sizeof(type) * unit_count).
	ErrNotEnoughData = errors.New("not enough data for type")

	// ErrUnhandledUndefinedTypedTag is used when we try to parse a tag that's
	// recorded as an "unknown" type but not a documented tag (therefore
	// leaving us not knowning how to read it).
	ErrUnhandledUndefinedTypedTag = errors.New("not a standard unknown-typed tag")

	// ErrUnparseableValue is the error for a value that we should have been
	// able to parse but were not able to.
	ErrUnparseableValue = errors.New("unparseable undefined tag")
)
View Source
var (
	ErrEmptyTag = errors.New("Error empty tag")
)

Errors

Functions

This section is empty.

Types

type ExifReader

type ExifReader interface {
	io.ReaderAt
	ByteOrder() binary.ByteOrder
}

ExifReader interface

type Parser

type Parser struct{}

Parser knows how to parse all well-defined, encoded EXIF types.

func (*Parser) ParseASCII

func (p *Parser) ParseASCII(data []byte, unitCount uint32) (value string, err error)

ParseASCII returns a string and auto-strips the trailing NUL character that should be at the end of the encoding. TODO: Add Test & Benchmark

func (*Parser) ParseASCIINoNul

func (p *Parser) ParseASCIINoNul(data []byte, unitCount uint32) (value string, err error)

ParseASCIINoNul returns a string without any consideration for a trailing NUL character. TODO: Add Test & Benchmark

func (*Parser) ParseBytes

func (p *Parser) ParseBytes(data []byte, unitCount uint32) (value []uint8, err error)

TODO: Add Test & Benchmark

func (*Parser) ParseLongs

func (p *Parser) ParseLongs(data []byte, unitCount uint32, byteOrder binary.ByteOrder) (value []uint32, err error)

ParseLongs knows how to encode an encoded list of unsigned longs. TODO: Add Test & Benchmark

func (*Parser) ParseRationals

func (p *Parser) ParseRationals(data []byte, unitCount uint32, byteOrder binary.ByteOrder) (value []Rational, err error)

ParseRationals knows how to parse an encoded list of unsigned rationals. TODO: Add Test & Benchmark

func (*Parser) ParseShorts

func (p *Parser) ParseShorts(data []byte, unitCount uint32, byteOrder binary.ByteOrder) (value []uint16, err error)

ParseShorts knows how to parse an encoded list of shorts. TODO: Add Test & Benchmark

func (*Parser) ParseSignedLongs

func (p *Parser) ParseSignedLongs(data []byte, unitCount uint32, byteOrder binary.ByteOrder) (value []int32, err error)

ParseSignedLongs knows how to parse an encoded list of signed longs. TODO: Add Test & Benchmark

func (*Parser) ParseSignedRationals

func (p *Parser) ParseSignedRationals(data []byte, unitCount uint32, byteOrder binary.ByteOrder) (value []SignedRational, err error)

ParseSignedRationals knows how to parse an encoded list of signed rationals. TODO: Add Test & Benchmark

type Rational

type Rational struct {
	Numerator   uint32
	Denominator uint32
}

Rational -

type SignedRational

type SignedRational struct {
	Numerator   int32
	Denominator int32
}

SignedRational -

type Tag

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

Tag - is an Exif Tag

func NewTag

func NewTag(name string, tagType TagType) Tag

NewTag -

func (Tag) GetInt

func (tag Tag) GetInt(exifReader ExifReader) (value int, err error)

GetInt - WIP

func (Tag) GetRational

func (tag Tag) GetRational(exifReader ExifReader) (numerator int, denominator int, err error)

GetRational - WIP

func (Tag) GetRationals

func (tag Tag) GetRationals(exifReader ExifReader) (value []Rational, err error)

GetRationals - WIP

func (Tag) GetString

func (tag Tag) GetString(exifReader io.ReaderAt) (value string, err error)

GetString - WIP

func (Tag) GetUint16

func (tag Tag) GetUint16(exifReader ExifReader) (values []uint16, err error)

GetUint16 - WIP

func (*Tag) Set

func (tag *Tag) Set(ifdPath string, tagID TagID, unitCount uint32, valueOffset uint32, rawValueOffset []byte)

Set tag

type TagID

type TagID uint16

TagID is the uint16 representation of an IFD tag

type TagMap

type TagMap map[TagID]Tag

TagMap - is a lookupmap for Tags using their TagID

type TagType

type TagType uint8

TagType -

const (
	// TypeByte describes an encoded list of bytes.
	TypeByte TagType = 1

	// TypeASCII describes an encoded list of characters that is terminated
	// with a NUL in its encoded form.
	TypeASCII TagType = 2

	// TypeShort describes an encoded list of shorts.
	TypeShort TagType = 3

	// TypeLong describes an encoded list of longs.
	TypeLong TagType = 4

	// TypeRational describes an encoded list of rationals.
	TypeRational TagType = 5

	// TypeUndefined describes an encoded value that has a complex/non-clearcut
	// interpretation.
	TypeUndefined TagType = 7

	// TypeSignedLong describes an encoded list of signed longs.
	TypeSignedLong TagType = 9

	// TypeSignedRational describes an encoded list of signed rationals.
	TypeSignedRational TagType = 10

	// TypeASCIINoNul is just a pseudo-type, for our own purposes.
	TypeASCIINoNul TagType = 0xf0
)

TagTypes defined Copied from dsoprea/go-exif

func (TagType) IsValid

func (tagType TagType) IsValid() bool

IsValid returns true if tagType is a valid type.

func (TagType) Size

func (tagType TagType) Size() int

Size returns the size of one atomic unit of the type.

func (TagType) String

func (tagType TagType) String() string

String returns the name of the Tag Type

Jump to

Keyboard shortcuts

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