Documentation ¶
Overview ¶
Package tiff implements TIFF decoding as defined in TIFF 6.0 specification.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Dir ¶
type Dir struct {
Tags []*Tag
}
Dir reflects 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 be relative to the beginning of the tiff structure (not relative to the beginning of the IFD).
type FormatType ¶
type FormatType int
const ( IntVal FormatType = iota FloatVal RatVal StringVal UndefVal OtherVal )
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 // Fmt is an integer (1 through 12) indicating the tag value's format. Fmt uint16 // Ncomp is the number of type Fmt stored in the tag's value (i.e. the tag's // value is an array of type Fmt and length Ncomp). Ncomp uint32 // Val holds the bytes that represent the tag's value. Val []byte // 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 Tag object. The first read from r should be the first byte of the tag. ReadAt offsets should 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 panics if the tag format is not FloatVal or if the tag value has no i'th component.
func (*Tag) Format ¶
func (t *Tag) Format() FormatType
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 panics if the tag format is not IntVal or if the tag value has no i'th component.
func (*Tag) MarshalJSON ¶
func (*Tag) Rat ¶
Rat returns the tag's i'th value as a rational number. It panics if the tag format is not RatVal, if the denominator is zero, or if the tag has no i'th component. If a denominator could be zero, use Rat2.
func (*Tag) Rat2 ¶
Rat2 returns the tag's i'th value as a rational number represented by a numerator-denominator pair. It panics if the tag format is not RatVal or if the tag value has no i'th component.
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 decoded tiff data.