Documentation ¶
Overview ¶
Package rawparser provides a basic parsing interface for camera raw files. The current incarnation supports TIFF-based RAW files (e.g., Canon CR2, Nikon NEF...).
TIFF specification: http://partners.adobe.com/public/developer/en/tiff/TIFF6.pdf
Index ¶
Constants ¶
const Cr2ParserKey = "CR2"
Cr2ParserKey is a unique identifier for the CR2 raw file parser. This key may be used as a key the RawParsers map.
const NefParserKey = "NEF"
NefParserKey is a unique identifier for the NEF raw file parser. This key may be used as a key the RawParsers map.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cr2Parser ¶
type Cr2Parser struct {
// contains filtered or unexported fields
}
Cr2Parser is the struct defining the state of the RawFile concept. Implements the RawParser interface. This parser provides basic parsing functionaity for the Canon Raw Format 2 (CR2). For a specified CR2, the EXIF create time and orientation are parsed and the embedded JPEG is extracted. The following are resources on CR2 file details:
CR2-specific information: http://lclevy.free.fr/cr2 TIFF specification: http://partners.adobe.com/public/developer/en/tiff/TIFF6.pdf
func (Cr2Parser) IsHostLittleEndian ¶
func (r Cr2Parser) IsHostLittleEndian() bool
IsHostLittleEndian is a function to get the host's endianness specified for the given instance of the RawParser. Returns true if the host is a little endian machine.
func (Cr2Parser) ProcessFile ¶
func (n Cr2Parser) ProcessFile(info *RawFileInfo) (CR2 *RawFile, err error)
ProcessFile is the entry point into the Cr2Parser. For a specified CR2, via RawFileInfo, the file shall be processed, JPEG extracted, and processed details returned to the caller. Returns a pointer the RawFile data structure or error.
func (Cr2Parser) SetHostIsLittleEndian ¶
func (r Cr2Parser) SetHostIsLittleEndian(hostIsLe bool)
SetHostIsLittleEndian is a function to set the host's endianness for the given instance of the RawParser. Set to true if host is a little endian machine; false otherwise.
type NefParser ¶
type NefParser struct {
// contains filtered or unexported fields
}
NefParser is the struct defining the state of the RawFile concept. Implements the RawParser interface. This parser provides basic parsing functionaity for the Nikon Electronic Format (NEF). For a specified NEF, the EXIF create time and orientation are parsed and the embedded JPEG is extracted. The following are resources on NEF file details:
NEF-specific information: http://lclevy.free.fr/nef/ TIFF specification: http://partners.adobe.com/public/developer/en/tiff/TIFF6.pdf
func (NefParser) IsHostLittleEndian ¶
func (r NefParser) IsHostLittleEndian() bool
IsHostLittleEndian is a function to get the host's endianness specified for the given instance of the RawParser. Returns true if the host is a little endian machine.
func (NefParser) ProcessFile ¶
func (n NefParser) ProcessFile(info *RawFileInfo) (nef *RawFile, err error)
ProcessFile is the entry point into the NefParser. For a specified NEF, via RawFileInfo, the file shall be processed, JPEG extracted, and processed details returned to the caller. Returns a pointer the RawFile data structure or error.
func (NefParser) SetHostIsLittleEndian ¶
func (r NefParser) SetHostIsLittleEndian(hostIsLe bool)
SetHostIsLittleEndian is a function to set the host's endianness for the given instance of the RawParser. Set to true if host is a little endian machine; false otherwise.
type RawFile ¶
type RawFile struct { // Note: additional EXIF metadata may be added in future release. CreateDate time.Time FileName, JpegPath string JpegOrientation float64 }
RawFile is a struct representing parsed results for a specific raw file.
type RawFileInfo ¶
RawFileInfo is a struct defining key information for parsing a RawFile.
type RawParser ¶
type RawParser interface { // ProcessFile processes a raw file per the implementation of this parser. // Return a pointer to a RawFile struct or error. ProcessFile(i *RawFileInfo) (r *RawFile, e error) // SetHostIsLittleEndian is a function to set the RawParser host's // endianness. // Set to true if host is a little endian machine; false otherwise. SetHostIsLittleEndian(b bool) // IsLittleEndian is a function to get the value of the specified host // endianness. // Returns true if the host is a little endian machine. IsHostLittleEndian() bool }
RawParser is the defining interface of a raw file parser. Camera-specific parsers shall implement this interface.
func NewCr2Parser ¶
NewCr2Parser creates an instance of Cr2Parser. Returns a pointer to a Cr2Parser instance.
func NewNefParser ¶
NewNefParser creates an instance of NEF-specific RawParser. Returns an instance of a NEF-specific RawParser.
type RawParsers ¶
type RawParsers struct {
// contains filtered or unexported fields
}
RawParsers is a structure containing a mapping of registered raw file parsers. The key is the lower-case file extension of the raw file type; the value is the pointer to the RawParser implementation.
func NewRawParsers ¶
func NewRawParsers() *RawParsers
NewRawParsers creates an instance of RawParsers.
func (*RawParsers) DeleteParser ¶
func (p *RawParsers) DeleteParser(key string)
DeleteParser removes the specified RawParser.
func (RawParsers) GetParser ¶
func (p RawParsers) GetParser(key string) *RawParser
GetParser returns a RawParser for a given raw file type or nil if not found.
func (*RawParsers) Register ¶
func (p *RawParsers) Register(key string, parser *RawParser)
Register maps the implementation of the RawParser interface to the key.