Documentation
¶
Overview ¶
Package exif provides functions for parsing and extracting Exif Information.
Index ¶
- Variables
- func NikonMkNoteHeader(reader io.Reader) (byteOrder binary.ByteOrder, err error)
- type Data
- func (e *Data) Aperture() (meta.Aperture, error)
- func (e *Data) Artist() (artist string, err error)
- func (e *Data) CameraMake() (make string)
- func (e *Data) CameraModel() (model string)
- func (e *Data) CameraSerial() (serial string, err error)
- func (e *Data) CanonAFInfo() (afInfo canon.AFInfo, err error)
- func (e *Data) CanonCameraSettings() (canon.CameraSettings, error)
- func (e *Data) CanonFileInfo() (canon.FileInfo, error)
- func (e *Data) CanonShotInfo() (canon.ShotInfo, error)
- func (e *Data) Copyright() (copyright string, err error)
- func (e *Data) DateTime(tz *time.Location) (tm time.Time, err error)
- func (e *Data) DebugJSON() ([]byte, error)
- func (e *Data) Dimensions() (dimensions meta.Dimensions)
- func (e *Data) ExposureBias() (meta.ExposureBias, error)
- func (e *Data) ExposureMode() (meta.ExposureMode, error)
- func (e *Data) ExposureProgram() (meta.ExposureProgram, error)
- func (e *Data) ExposureValue() (ev float32, err error)
- func (e *Data) Flash() (meta.Flash, error)
- func (e *Data) FocalLength() (fl meta.FocalLength, err error)
- func (e *Data) FocalLengthIn35mmFilm() (fl meta.FocalLength, err error)
- func (e *Data) GPSAltitude() (alt float32, err error)
- func (e *Data) GPSCellID() (cellID s2.CellID, err error)
- func (e *Data) GPSCoords() (lat float64, lng float64, err error)
- func (e *Data) GPSDate(tz *time.Location) (t time.Time, err error)
- func (e *Data) GetTag(ifd ifds.IfdType, ifdIndex uint8, tagID tag.ID) (tag.Tag, error)
- func (e *Data) GetTagValue(t tag.Tag) (value interface{})
- func (e *Data) ISOSpeed() (iso uint32, err error)
- func (e *Data) ImageHeight() uint16
- func (e *Data) ImageWidth() uint16
- func (e *Data) LensMake() (make string, err error)
- func (e *Data) LensModel() (model string, err error)
- func (e *Data) LensSerial() (serial string, err error)
- func (e *Data) MeteringMode() (meta.MeteringMode, error)
- func (e *Data) ModifyDate(tz *time.Location) (time.Time, error)
- func (e *Data) Orientation() meta.Orientation
- func (e *Data) ParseASCIIValue(t tag.Tag) (value string, err error)
- func (e *Data) ParseGPSCoord(refTag tag.Tag, coordTag tag.Tag) (coord float64, err error)
- func (e *Data) ParseGPSTimeStamp(ds tag.Tag, ts tag.Tag, subSec tag.Tag, tz *time.Location) (t time.Time, err error)
- func (e *Data) ParseIfd(header meta.ExifHeader) error
- func (e *Data) ParseRationalValue(t tag.Tag) (n, d uint32, err error)
- func (e *Data) ParseRationalValues(t tag.Tag) (value []tag.Rational, err error)
- func (e *Data) ParseSRationalValue(t tag.Tag) (num, denom int32, err error)
- func (e *Data) ParseSRationalValues(t tag.Tag) (value []tag.SRational, err error)
- func (e *Data) ParseSubSec(subSec tag.Tag) (int, error)
- func (e *Data) ParseTimeStamp(date tag.Tag, subSec tag.Tag, tz *time.Location) (t time.Time, err error)
- func (e *Data) ParseUint16Value(t tag.Tag) (uint16, error)
- func (e *Data) ParseUint16Values(t tag.Tag) (value []uint16, err error)
- func (e *Data) ParseUint32Value(t tag.Tag) (value uint32, err error)
- func (e *Data) ParseUint32Values(t tag.Tag) (value []uint32, err error)
- func (e *Data) RangeTags() chan tag.Tag
- func (e *Data) ShutterSpeed() (meta.ShutterSpeed, error)
- type Exif
Constants ¶
This section is empty.
Variables ¶
var ( // ErrGpsCoordsNotValid means that some part of the geographic data were unparseable. ErrGpsCoordsNotValid = errors.New("error GPS coordinates not valid") // ErrGPSRationalNotValid means that the rawCoordinates were not long enough. ErrGPSRationalNotValid = errors.New("error GPS Coords requires a raw-coordinate with exactly three rationals") )
var ( // Alias to meta Errors ErrInvalidHeader = meta.ErrInvalidHeader ErrNoExif = meta.ErrNoExif ErrEmptyTag = errors.New("error empty tag") )
Errors
var ( ErrParseBufSize = errors.New("error parse has insufficient data") ErrParseGPS = errors.New("error parsing GPS coords") ErrParseTimeStamp = errors.New("error parsing timestamp") ErrParseSubSecond = errors.New("error parsing sub second") ErrParseRationals = errors.New("error parsing rationals") )
Parsing Errors
var (
ErrNikonMkNote = errors.New("error makernote is not a Nikon makernote")
)
Errors
var (
ErrReadNegativeOffset = errors.New("error read at negative offset")
)
reader errors
var (
InfoLogger *log.Logger
)
Functions ¶
Types ¶
type Data ¶
type Data struct {
// contains filtered or unexported fields
}
Data struct contains parsed Exif information
func ParseExif ¶
ParseExif parses Exif metadata from an io.ReaderAt and a TiffHeader
If the header is invalid ParseExif will return ErrInvalidHeader.
func (*Data) CameraMake ¶
CameraMake convenience func. "IFD" Make
func (*Data) CameraModel ¶
CameraModel convenience func. "IFD" Model
func (*Data) CameraSerial ¶
CameraSerial convenience func. "IFD/Exif" BodySerialNumber
func (*Data) CanonAFInfo ¶
CanonAFInfo - Canon Camera AutoFocus Information from the Makernote
func (*Data) CanonCameraSettings ¶
func (e *Data) CanonCameraSettings() (canon.CameraSettings, error)
CanonCameraSettings convenience func. "IFD/Exif/Makernotes.Canon" CanonCameraSettings Canon Camera Settings from the Makernote
func (*Data) CanonFileInfo ¶
CanonFileInfo convenience func. "IFD/Exif/Makernotes.Canon" CanonFileInfo Canon Camera File Info from the Makernote
func (*Data) CanonShotInfo ¶
CanonShotInfo convenience func. "IFD/Exif/Makernotes.Canon" CanonShotInfo Canon Camera Shot Info from the Makernote
func (*Data) DateTime ¶
DateTime returns a time.Time that corresponds with when it was created. Since EXIF data does not contain any timezone information, you should select a timezone using tz. If tz is nil UTC is assumed.
func (*Data) DebugJSON ¶
DebugJSON implements the JSONMarshaler interface that is used by encoding/json This is used primarily for testing and debuging.
func (*Data) Dimensions ¶
func (e *Data) Dimensions() (dimensions meta.Dimensions)
Dimensions convenience func. "IFD" Dimensions
func (*Data) ExposureBias ¶
func (e *Data) ExposureBias() (meta.ExposureBias, error)
ExposureBias convenience func. "IFD/Exif" ExposureBiasValue TODO: Add ExposureBias Function (Incomplete)
func (*Data) ExposureMode ¶
func (e *Data) ExposureMode() (meta.ExposureMode, error)
ExposureMode convenience func. "IFD/Exif" ExposureMode
func (*Data) ExposureProgram ¶
func (e *Data) ExposureProgram() (meta.ExposureProgram, error)
ExposureProgram convenience func. "IFD/Exif" ExposureProgram
func (*Data) ExposureValue ¶
ExposureValue convenience func. "IFD/Exif" ShutterSpeedValue
func (*Data) FocalLength ¶
func (e *Data) FocalLength() (fl meta.FocalLength, err error)
FocalLength convenience func. "IFD/Exif" FocalLength Lens Focal Length in mm
func (*Data) FocalLengthIn35mmFilm ¶
func (e *Data) FocalLengthIn35mmFilm() (fl meta.FocalLength, err error)
FocalLengthIn35mmFilm convenience func. "IFD/Exif" FocalLengthIn35mmFilm Lens Focal Length Equivalent for 35mm sensor in mm
func (*Data) GPSAltitude ¶
GPSAltitude convenience func. for "IFD/GPS" GPSAltitude and GPSAltitudeRef. Altitude is expressed as one RATIONAL value. The reference unit is meters.
func (*Data) GPSCellID ¶
GPSCellID returns the S2 cellID of the geographic location on the earth. A convenience func. that retrieves "IFD/GPS" GPSLatitude and GPSLongitude and converts them into an S2 CellID and returns the CellID.
If the CellID is not valid it returns ErrGpsCoordsNotValid.
func (*Data) GPSCoords ¶
GPSCoords is a convenience func. that retrieves "IFD/GPS" GPSLatitude and GPSLongitude
func (*Data) GPSDate ¶
GPSDate convenience func. for "IFD/GPS" GPSDateStamp and GPSTimeStamp. Indicates the time as UTC (Coordinated Universal Time). Optionally sets subsecond based on "IFD/Exif" SubSecTimeOriginal. Sets time zone to time.UTC if non-provided.
func (*Data) GetTagValue ¶
GetTagValue returns the tag's value as an interface.
For performance reasons its preferable to use the Parse* functions.
func (*Data) ImageHeight ¶
ImageHeight retturns the main image height
func (*Data) ImageWidth ¶
ImageWidth returns the main image width
func (*Data) LensSerial ¶
LensSerial convenience func. "IFD/Exif" LensSerialNumber
func (*Data) MeteringMode ¶
func (e *Data) MeteringMode() (meta.MeteringMode, error)
MeteringMode convenience func. "IFD/Exif" MeteringMode
func (*Data) ModifyDate ¶
ModifyDate returns a time.Time that corresponds with when it was last modified. Since EXIF data does not contain any timezone information, you should select a timezone using tz. If tz is nil UTC is assumed.
func (*Data) Orientation ¶
func (e *Data) Orientation() meta.Orientation
Orientation convenience func. If the tag is missing, OrientationHorizontal (normal) and ErrEmptyTag will be returned.
func (*Data) ParseASCIIValue ¶
ParseASCIIValue parses the ASCII value of the tag as a string and returns an error if it encounters one
func (*Data) ParseGPSCoord ¶
ParseGPSCoord parses the GPS Coordinate (Lat or Lng) with the corresponding reference Tag.
func (*Data) ParseGPSTimeStamp ¶
func (e *Data) ParseGPSTimeStamp(ds tag.Tag, ts tag.Tag, subSec tag.Tag, tz *time.Location) (t time.Time, err error)
ParseGPSTimeStamp parses the GPSDateStamp, GPSTimeStamp Tags in the given Timezone in UTC. Optionally add subSec tag from Exif.
func (*Data) ParseRationalValue ¶
ParseRationalValue parses the Rational value and returns a numerator and denominator for a single Unsigned Rational
func (*Data) ParseRationalValues ¶
ParseRationalValues returns a list of unsignedRationals
func (*Data) ParseSRationalValue ¶
ParseSRationalValue returns a numerator and denominator for a single Signed Rational
func (*Data) ParseSRationalValues ¶
ParseSRationalValues returns a list of unsignedRationals
func (*Data) ParseSubSec ¶
ParseSubSec parses a Subsecond Tag and returns an int in Nanoseconds. Returns ErrParseSubSecond if an err occurs
func (*Data) ParseTimeStamp ¶
func (e *Data) ParseTimeStamp(date tag.Tag, subSec tag.Tag, tz *time.Location) (t time.Time, err error)
ParseTimeStamp parses a time.Time from 2 ASCII Tag's. ex: 1997:09:01 12:00:00 Based on: http://www.cipa.jp/std/documents/e/DC-008-2012_E.pdf (Last checked: 24/02/2021)
func (*Data) ParseUint16Value ¶
ParseUint16Value returns the Short value of the tag as a uint16 and returns an error if it encounters one.
Warning: it returns only the first value if there are more values use Uint16Values function
func (*Data) ParseUint16Values ¶
ParseUint16Values parses the Short value of the tag as a uint16 array and returns an error if it encounters one.
func (*Data) ParseUint32Value ¶
ParseUint32Value returns the Short or Long value of the tag as a uint32 and returns an error if it encounters one.
Warning: it returns only the first value if there are more values use Uint16Values (Short) or Unit32Values (Long) function
func (*Data) ParseUint32Values ¶
ParseUint32Values parses the Long value of the tag as a uint32 array and returns an error if it encounters one.
func (*Data) ShutterSpeed ¶
func (e *Data) ShutterSpeed() (meta.ShutterSpeed, error)
ShutterSpeed convenience func. "IFD/Exif" ExposureTime
type Exif ¶
type Exif interface { // Aperture convenience func. "IFD/Exif" FNumber Aperture() (meta.Aperture, error) // Artist convenience func. "IFD" Artist Artist() (artist string, err error) // CameraSerial convenience func. "IFD/Exif" BodySerialNumber CameraSerial() (serial string, err error) // CameraMake convenience func. "IFD" Make CameraMake() (make string) // CameraModel convenience func. "IFD" Model CameraModel() (model string) // Copyright convenience func. "IFD" Copyright Copyright() (copyright string, err error) // Dimensions convenience func. "IFD" Dimensions Dimensions() (dimensions meta.Dimensions) // ExposureBias convenience func. "IFD/Exif" ExposureBiasValue ExposureBias() (meta.ExposureBias, error) // ExposureProgram convenience func. "IFD/Exif" ExposureProgram ExposureProgram() (meta.ExposureProgram, error) // ExposureMode convenience func. "IFD/Exif" ExposureMode ExposureMode() (meta.ExposureMode, error) // Flash convenience func. "IFD/Exif" Flash Flash() (meta.Flash, error) // FocalLength convenience func. "IFD/Exif" FocalLength // Lens Focal Length in mm FocalLength() (fl meta.FocalLength, err error) // FocalLengthIn35mmFilm convenience func. "IFD/Exif" FocalLengthIn35mmFilm // Lens Focal Length Equivalent for 35mm sensor in mm FocalLengthIn35mmFilm() (fl meta.FocalLength, err error) // ISOSpeed convenience func. "IFD/Exif" ISOSpeed ISOSpeed() (iso uint32, err error) // LensMake convenience func. "IFD/Exif" LensMake LensMake() (make string, err error) // LensModel convenience func. "IFD/Exif" LensModel LensModel() (model string, err error) // LensSerial convenience func. "IFD/Exif" LensSerialNumber LensSerial() (serial string, err error) // MeteringMode convenience func. "IFD/Exif" MeteringMode MeteringMode() (meta.MeteringMode, error) // Orientation convenience func. "IFD" Orientation Orientation() meta.Orientation // ShutterSpeed convenience func. "IFD/Exif" ExposureTime ShutterSpeed() (meta.ShutterSpeed, error) // GPSCoords convenience func. "IFD/GPS" Latitude and Longitude GPSCoords() (lat float64, lng float64, err error) // GPSCellID convenience func. "IFD/GPS" Latitude and Longitude converted to S2 cellID GPSCellID() (cellID s2.CellID, err error) // DateTime returns a time.Time that corresponds with when it was created. // Since EXIF data does not contain any timezone information, you should // select a timezone using tz. If tz is nil UTC is assumed. DateTime(tz *time.Location) (tm time.Time, err error) // ModifyDate returns a time.Time that corresponds with when it was last modified. // Since EXIF data does not contain any timezone information, you should // select a timezone using tz. If tz is nil UTC is assumed. ModifyDate(tz *time.Location) (time.Time, error) // GPSDate convenience func. for "IFD/GPS" GPSDateStamp and GPSTimeStamp. // Indicates the time as UTC (Coordinated Universal Time). // Optionally sets subsecond based on "IFD/Exif" SubSecTimeOriginal. // Sets time zone to time.UTC if non-provided. GPSDate(tz *time.Location) (t time.Time, err error) // GPSAltitude convenience func. for "IFD/GPS" GPSAltitude and GPSAltitudeRef. // Altitude is expressed as one RATIONAL value. The reference unit is meters. GPSAltitude() (alt float32, err error) // ExposureValue convenience func. "IFD/Exif" ShutterSpeedValue ExposureValue() (ev float32, err error) // CanonCameraSettings convenience func. "IFD/Exif/Makernotes.Canon" CanonCameraSettings // Canon Camera Settings from the Makernote CanonCameraSettings() (canon.CameraSettings, error) // CanonFileInfo convenience func. "IFD/Exif/Makernotes.Canon" CanonFileInfo // Canon Camera File Info from the Makernote CanonFileInfo() (canon.FileInfo, error) // CanonShotInfo convenience func. "IFD/Exif/Makernotes.Canon" CanonShotInfo // Canon Camera Shot Info from the Makernote CanonShotInfo() (canon.ShotInfo, error) // CanonAFInfo convenience func. "IFD/Exif/Makernotes.Canon" CanonAFInfo // Canon Camera AutoFocus Information from the Makernote CanonAFInfo() (afInfo canon.AFInfo, err error) }
Exif is an interface representation of Exif Information
Source Files
¶
Directories
¶
Path | Synopsis |
---|---|
Package ifds provides types and functions for decoding tiff Ifds
|
Package ifds provides types and functions for decoding tiff Ifds |
exififd
Package exififd provides types for "RootIfd/ExifIfd"
|
Package exififd provides types for "RootIfd/ExifIfd" |
gpsifd
Package gpsifd provides types for "RootIfd/GPSIfd"
|
Package gpsifd provides types for "RootIfd/GPSIfd" |
mknote
Package mknote provides functions and types for decoding Exif Makernote values
|
Package mknote provides functions and types for decoding Exif Makernote values |
Package tag provides types and functions for decoding Exif Tags
|
Package tag provides types and functions for decoding Exif Tags |