Documentation ¶
Overview ¶
Package tiff implements TIFF decoding as defined in TIFF 6.0 specification at http://partners.adobe.com/public/developer/en/tiff/TIFF6.pdf
Index ¶
- Variables
- type DataType
- type Dir
- type Format
- type ReadAtReader
- type Tag
- func (t *Tag) Float(i int) (float64, error)
- func (t *Tag) Format() Format
- func (t *Tag) Int(i int) (int, error)
- func (t *Tag) Int64(i int) (int64, error)
- func (t *Tag) MarshalJSON() ([]byte, error)
- func (t *Tag) Rat(i int) (*big.Rat, error)
- func (t *Tag) Rat2(i int) (num, den int64, err error)
- func (t *Tag) String() string
- func (t *Tag) StringVal() (string, error)
- type Tiff
Constants ¶
This section is empty.
Variables ¶
var ErrShortReadTagValue = errors.New("tiff: short read of tag value")
Functions ¶
This section is empty.
Types ¶
type Dir ¶
type Dir struct {
Tags []*Tag
}
Dir provides access to the parsed content of a tiff Image File Directory (IFD).
func DecodeDir ¶
DecodeDir parses a tiff-encoded IFD from r and returns a Dir object. offset is the offset to the next IFD. The first read from r should be at the first byte of the IFD. ReadAt offsets should generally be relative to the beginning of the tiff structure (not relative to the beginning of the IFD).
type Format ¶
type Format int
Format specifies the Go type equivalent used to represent the basic tiff data types.
type ReadAtReader ¶
ReadAtReader is used when decoding Tiff tags and directories
type Tag ¶
type Tag struct { // Id is the 2-byte tiff tag identifier. Id uint16 // Type is an integer (1 through 12) indicating the tag value's data type. Type DataType // Count is the number of type Type stored in the tag's value (i.e. the // tag's value is an array of type Type and length Count). Count uint32 // Val holds the bytes that represent the tag's value. Val []byte // ValOffset holds byte offset of the tag value w.r.t. the beginning of the // reader it was decoded from. Zero if the tag value fit inside the offset // field. ValOffset uint32 // contains filtered or unexported fields }
Tag reflects the parsed content of a tiff IFD tag.
func DecodeTag ¶
func DecodeTag(r ReadAtReader, order binary.ByteOrder) (*Tag, error)
DecodeTag parses a tiff-encoded IFD tag from r and returns a Tag object. The first read from r should be the first byte of the tag. ReadAt offsets should generally be relative to the beginning of the tiff structure (not relative to the beginning of the tag).
func (*Tag) Float ¶
Float returns the tag's i'th value as a float. It returns an error if the tag's Format is not IntVal. It panics if i is out of range.
func (*Tag) Format ¶
Format returns a value indicating which method can be called to retrieve the tag's value properly typed (e.g. integer, rational, etc.).
func (*Tag) Int ¶
Int returns the tag's i'th value as an integer. It returns an error if the tag's Format is not IntVal. It panics if i is out of range.
func (*Tag) Int64 ¶
Int64 returns the tag's i'th value as an integer. It returns an error if the tag's Format is not IntVal. It panics if i is out of range.
func (*Tag) MarshalJSON ¶
func (*Tag) Rat ¶
Rat returns the tag's i'th value as a rational number. It returns a nil and an error if this tag's Format is not RatVal. It panics for zero deminators or if i is out of range.
func (*Tag) Rat2 ¶
Rat2 returns the tag's i'th value as a rational number represented by a numerator-denominator pair. It returns an error if the tag's Format is not RatVal. It panics if i is out of range.
type Tiff ¶
type Tiff struct { // Dirs is an ordered slice of the tiff's Image File Directories (IFDs). // The IFD at index 0 is IFD0. Dirs []*Dir // The tiff's byte-encoding (i.e. big/little endian). Order binary.ByteOrder }
Tiff provides access to a decoded tiff data structure.