meta

package
v0.0.0-...-d8b26cd Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: AGPL-3.0 Imports: 31 Imported by: 0

Documentation

Overview

Package meta provides XMP and Exif metadata parsing and normalization.

Copyright (c) 2018 - 2024 PhotoPrism UG. All rights reserved.

This program is free software: you can redistribute it and/or modify
it under Version 3 of the GNU Affero General Public License (the "AGPL"):
<https://docs.photoprism.app/license/agpl>

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Affero General Public License for more details.

The AGPL is supplemented by our Trademark and Brand Guidelines,
which describe how our Brand Assets may be used:
<https://www.photoprism.app/trademark>

Feel free to send an email to hello@photoprism.app if you have questions, want to support our work, or just want to say hello.

Additional information can be found in our Developer Guide: <https://docs.photoprism.app/developer-guide/>

Index

Constants

View Source
const (
	LatMax = 90
	LngMax = 180
)
View Source
const (
	KeywordFlash           = "flash"
	KeywordHdr             = "hdr"
	KeywordBurst           = "burst"
	KeywordPanorama        = "panorama"
	KeywordEquirectangular = string(projection.Equirectangular)
)
View Source
const CodecAv1 = string(video.CodecAV1)
View Source
const CodecAvc1 = string(video.CodecAVC)
View Source
const CodecHeic = "heic"
View Source
const CodecHvc1 = string(video.CodecHVC)
View Source
const CodecJpeg = "jpeg"
View Source
const CodecUnknown = ""
View Source
const CodecXMP = "xmp"
View Source
const (
	ImageTypeHDR = 3 // see https://exiftool.org/TagNames/Apple.html
)
View Source
const MimeQuicktime = "video/quicktime"
View Source
const MimeVideoMP4 = "video/mp4"

Variables

View Source
var Docs = [][]string{
	{"Exiftool", "https://exiftool.org/TagNames/EXIF.html"},
	{"Exiftool XMP", "https://exiftool.org/TagNames/XMP.html"},
	{"Adobe XMP", "https://docs.photoprism.app/developer-guide/metadata/xmp/#specification"},
	{"Dublin Core (DCMI)", "https://www.dublincore.org/specifications/dublin-core/dcmi-terms/"},
	{"IPTC Photo Metadata", "https://iptc.org/standards/photo-metadata/iptc-standard/"},
}
View Source
var GpsCoordsRegexp = regexp.MustCompile("[0-9\\.]+")
View Source
var GpsFloatRegexp = regexp.MustCompile("[+\\-]?(?:(?:0|[1-9]\\d*)(?:\\.\\d*)?|\\.\\d+)")
View Source
var GpsRefRegexp = regexp.MustCompile("[NSEW]+")
View Source
var LowerCaseRegexp = regexp.MustCompile("[a-z\\d_\\-]+")
View Source
var UnwantedDescriptions = map[string]bool{
	"Created by Imlib":         true,
	"iClarified":               true,
	"OLYMPUS DIGITAL CAMERA":   true,
	"SAMSUNG":                  true,
	"SAMSUNG CAMERA PICTURES":  true,
	"<Digimax i5, Samsung #1>": true,
	"SONY DSC":                 true,
	"rhdr":                     true,
	"hdrpl":                    true,
	"oznorWO":                  true,
	"frontbhdp":                true,
	"fbt":                      true,
	"rbt":                      true,
	"ptr":                      true,
	"fbthdr":                   true,
	"btr":                      true,
	"mon":                      true,
	"nor":                      true,
	"dav":                      true,
	"mde":                      true,
	"mde_soft":                 true,
	"edf":                      true,
	"btfmdn":                   true,
	"btf":                      true,
	"btfhdr":                   true,
	"frem":                     true,
	"oznor":                    true,
	"rpt":                      true,
	"burst":                    true,
	"sdr_HDRB":                 true,
	"cof":                      true,
	"qrf":                      true,
	"fshbty":                   true,
	"binary comment":           true,
	"default":                  true,
	"Exif_JPEG_PICTURE":        true,
	"DVC 10.1 HDMI":            true,
	"charset=Ascii":            true,
}

Functions

func Duration

func Duration(s string) (result time.Duration)

Duration converts a metadata string to a valid duration.

func GpsToDecimal

func GpsToDecimal(s string) float64

GpsToDecimal returns the GPS latitude or longitude as decimal float point number.

func GpsToLatLng

func GpsToLatLng(s string) (lat, lng float64)

GpsToLatLng returns the GPS latitude and longitude as float point number.

func NormalizeGPS

func NormalizeGPS(lat, lng float64) (float32, float32)

NormalizeGPS normalizes the longitude and latitude of the GPS position to a generally valid range.

func ParseFloat

func ParseFloat(s string) float64

ParseFloat returns a single GPS coordinate value as floating point number (degree, minute or second).

func RawExif

func RawExif(fileName string, fileFormat fs.Type, bruteForce bool) (rawExif []byte, err error)

func Report

func Report(f interface{}) (rows [][]string, cols []string)

Report returns form fields as table rows for reports.

func SanitizeDescription

func SanitizeDescription(s string) string

SanitizeDescription normalizes descriptions and removes unwanted information.

func SanitizeMeta

func SanitizeMeta(s string) string

SanitizeMeta normalizes metadata fields that may contain JSON arrays like keywords and subject.

func SanitizeString

func SanitizeString(s string) string

SanitizeString removes unwanted character from an exif value string.

func SanitizeTitle

func SanitizeTitle(title string) string

SanitizeTitle normalizes titles and removes unwanted information.

func SanitizeUID

func SanitizeUID(s string) string

SanitizeUID normalizes unique IDs found in XMP or Exif metadata.

func SanitizeUnicode

func SanitizeUnicode(s string) string

SanitizeUnicode returns the string as valid Unicode with whitespace trimmed.

Types

type Data

type Data struct {
	FileName         string        `meta:"FileName"`
	MimeType         string        `meta:"MIMEType" report:"-"`
	DocumentID       string        `meta:"ContentIdentifier,MediaGroupUUID,BurstUUID,OriginalDocumentID,DocumentID,ImageUniqueID,DigitalImageGUID"` // see https://exiftool.org/forum/index.php?topic=14874.0
	InstanceID       string        `meta:"InstanceID,DocumentID"`
	CreatedAt        time.Time     `meta:"SubSecCreateDate,CreationDate,CreateDate,MediaCreateDate,ContentCreateDate,TrackCreateDate"`
	TakenAt          time.Time     `` /* 142-byte string literal not displayed */
	TakenAtLocal     time.Time     `meta:"SubSecDateTimeOriginal,SubSecDateTimeCreated,DateTimeOriginal,CreationDate,DateTimeCreated,DateTime,DateTimeDigitized"`
	TakenGps         time.Time     `meta:"GPSDateTime,GPSDateStamp"`
	TakenNs          int           `meta:"-"`
	TimeZone         string        `meta:"-"`
	TimeOffset       string        `meta:"OffsetTime,OffsetTimeOriginal,OffsetTimeDigitized"`
	MediaType        media.Type    `meta:"-"`
	HasThumbEmbedded bool          `meta:"ThumbnailImage,PhotoshopThumbnail" report:"-"`
	HasVideoEmbedded bool          `meta:"EmbeddedVideoFile,MotionPhoto,MotionPhotoVideo,MicroVideo" report:"-"`
	Duration         time.Duration `meta:"Duration,MediaDuration,TrackDuration,PreviewDuration"`
	FPS              float64       `meta:"VideoFrameRate,VideoAvgFrameRate"`
	Frames           int           `meta:"FrameCount,AnimationFrames"`
	Codec            string        `meta:"CompressorID,VideoCodecID,CodecID,OtherFormat,FileType"`
	Title            string        `meta:"Title,Headline" xmp:"dc:title" dc:"title,title.Alt"`
	Description      string        `meta:"Description,ImageDescription,Caption,Caption-Abstract" xmp:"Description,Description.Alt"`
	Subject          string        `meta:"Subject,PersonInImage,ObjectName,HierarchicalSubject,CatalogSets" xmp:"Subject"`
	Keywords         Keywords      `meta:"Keywords"`
	Favorite         bool          `meta:"Favorite"`
	Notes            string        `meta:"Comment,UserComment"`
	Artist           string        `meta:"Artist,Creator,By-line,OwnerName,Owner" xmp:"Creator"`
	Copyright        string        `meta:"Rights,Copyright,CopyrightNotice,WebStatement" xmp:"Rights,Rights.Alt"`
	License          string        `meta:"UsageTerms,License"`
	Projection       string        `meta:"ProjectionType"`
	ColorProfile     string        `meta:"ICCProfileName,ProfileDescription"`
	CameraMake       string        `meta:"CameraMake,Make" xmp:"Make"`
	CameraModel      string        `meta:"CameraModel,Model,CameraID,UniqueCameraModel" xmp:"CameraModel,Model"`
	CameraOwner      string        `meta:"OwnerName"`
	CameraSerial     string        `meta:"SerialNumber"`
	LensMake         string        `meta:"LensMake"`
	LensModel        string        `meta:"LensModel,Lens,LensID" xmp:"LensModel,Lens"`
	Software         string        `meta:"Software,CreatorTool,HistorySoftwareAgent,ProcessingSoftware"`
	Flash            bool          `meta:"FlashFired"`
	FocalLength      int           `meta:"FocalLength,FocalLengthIn35mmFormat"`
	FocalDistance    float64       `meta:"HyperfocalDistance"`
	Exposure         string        `meta:"ExposureTime,ShutterSpeedValue,ShutterSpeed,TargetExposureTime"`
	Aperture         float32       `meta:"ApertureValue,Aperture"`
	FNumber          float32       `meta:"FNumber"`
	Iso              int           `meta:"ISO"`
	ImageType        int           `meta:"HDRImageType"`
	GPSPosition      string        `meta:"GPSPosition"`
	GPSLatitude      string        `meta:"GPSLatitude"`
	GPSLongitude     string        `meta:"GPSLongitude"`
	Lat              float32       `meta:"-"`
	Lng              float32       `meta:"-"`
	Altitude         float64       `meta:"GlobalAltitude,GPSAltitude"`
	Width            int           `meta:"ImageWidth,PixelXDimension,ExifImageWidth,SourceImageWidth"`
	Height           int           `meta:"ImageHeight,ImageLength,PixelYDimension,ExifImageHeight,SourceImageHeight"`
	Orientation      int           `meta:"-"`
	Rotation         int           `meta:"Rotation"`
	Views            int           `meta:"-"`
	Albums           []string      `meta:"-"`
	Warning          string        `meta:"Warning" report:"-"`
	Error            error         `meta:"-"`
	// contains filtered or unexported fields
}

Data represents image metadata.

func Exif

func Exif(fileName string, fileType fs.Type, bruteForce bool) (data Data, err error)

Exif parses an image file for Exif metadata and returns as Data struct.

func JSON

func JSON(jsonName, originalName string) (data Data, err error)

JSON parses a json sidecar file (as used by Exiftool) and returns a Data struct.

func NewData

func NewData() Data

NewData returns a new Data struct with default values.

func XMP

func XMP(fileName string) (data Data, err error)

XMP parses an XMP file and returns a Data struct.

func (Data) ActualHeight

func (data Data) ActualHeight() int

ActualHeight is the height after rotating the media file if needed.

func (Data) ActualWidth

func (data Data) ActualWidth() int

ActualWidth is the width after rotating the media file if needed.

func (*Data) AddKeywords

func (data *Data) AddKeywords(w string)

AddKeywords appends keywords.

func (Data) AspectRatio

func (data Data) AspectRatio() float32

AspectRatio returns the aspect ratio based on width and height.

func (*Data) AutoAddKeywords

func (data *Data) AutoAddKeywords(s string)

AutoAddKeywords automatically appends relevant keywords from a string (e.g. description).

func (Data) CellID

func (data Data) CellID() string

CellID returns the S2 cell ID.

func (Data) CodecAvc

func (data Data) CodecAvc() bool

CodecAvc returns true if the video codec is AVC.

func (*Data) Exif

func (data *Data) Exif(fileName string, fileFormat fs.Type, bruteForce bool) (err error)

Exif parses an image file for Exif metadata and returns as Data struct.

func (*Data) Exiftool

func (data *Data) Exiftool(jsonData []byte, originalName string) (err error)

Exiftool parses JSON sidecar data as created by Exiftool.

func (*Data) GMeta

func (data *Data) GMeta(jsonData []byte) (err error)

GMeta parses JSON sidecar data as created by Google Photos.

func (*Data) GPhoto

func (data *Data) GPhoto(jsonData []byte) (err error)

GPhoto parses JSON photo sidecar data as created by Google Photos.

func (Data) HasDocumentID

func (data Data) HasDocumentID() bool

HasDocumentID returns true if a DocumentID exists.

func (Data) HasInstanceID

func (data Data) HasInstanceID() bool

HasInstanceID returns true if an InstanceID exists.

func (Data) HasTimeAndPlace

func (data Data) HasTimeAndPlace() bool

HasTimeAndPlace if data contains a time and GPS position.

func (Data) IsHDR

func (data Data) IsHDR() bool

IsHDR tests if it is a high dynamic range file.

func (*Data) JSON

func (data *Data) JSON(jsonName, originalName string) (err error)

JSON parses a json sidecar file (as used by Exiftool) and returns a Data struct.

func (Data) Megapixels

func (data Data) Megapixels() int

Megapixels returns the resolution in megapixels.

func (Data) Portrait

func (data Data) Portrait() bool

Portrait returns true if it is a portrait picture or video based on width and height.

func (*Data) XMP

func (data *Data) XMP(fileName string) (err error)

XMP parses an XMP file and returns a Data struct.

type GAlbum

type GAlbum struct {
	Title       string `json:"title"`
	Description string `json:"description"`
	Access      string `json:"access"`
	Location    string `json:"location"`
	Date        GTime  `json:"date"`
	Geo         GGeo   `json:"geoData"`
}

func (GAlbum) Exists

func (m GAlbum) Exists() bool

type GGeo

type GGeo struct {
	Lat      float64 `json:"latitude"`
	Lng      float64 `json:"longitude"`
	Altitude float64 `json:"altitude"`
}

func (GGeo) Exists

func (m GGeo) Exists() bool

type GMeta

type GMeta struct {
	Album GAlbum `json:"albumData"`
}

type GPhoto

type GPhoto struct {
	Title       string `json:"title"`
	Description string `json:"description"`
	Views       int    `json:"imageViews,string"`
	Geo         GGeo   `json:"geoData"`
	TakenAt     GTime  `json:"photoTakenTime"`
	CreatedAt   GTime  `json:"creationTime"`
	UpdatedAt   GTime  `json:"modificationTime"`
}

func (GPhoto) SanitizedDescription

func (m GPhoto) SanitizedDescription() string

func (GPhoto) SanitizedTitle

func (m GPhoto) SanitizedTitle() string

type GTime

type GTime struct {
	Unix      int64  `json:"timestamp,string"`
	Formatted string `json:"formatted"`
}

func (GTime) Exists

func (m GTime) Exists() bool

func (GTime) Time

func (m GTime) Time() time.Time

type Keywords

type Keywords []string

Keywords represents a list of metadata keywords.

func (Keywords) String

func (w Keywords) String() string

String returns a string containing all keywords.

type XmpDocument

type XmpDocument struct {
	XMLName xml.Name `xml:"xmpmeta" json:"xmpmeta,omitempty"`
	Text    string   `xml:",chardata" json:"text,omitempty"`
	X       string   `xml:"x,attr" json:"x,omitempty"`
	Xmptk   string   `xml:"xmptk,attr" json:"xmptk,omitempty"`
	RDF     struct {
		Text        string `xml:",chardata" json:"text,omitempty"`
		Rdf         string `xml:"rdf,attr" json:"rdf,omitempty"`
		Description struct {
			Text            string `xml:",chardata" json:"text,omitempty"`
			About           string `xml:"about,attr" json:"about,omitempty"`
			Xmp             string `xml:"xmp,attr" json:"xmp,omitempty"`
			Aux             string `xml:"aux,attr" json:"aux,omitempty"`
			ExifEX          string `xml:"exifEX,attr" json:"exifex,omitempty"`
			Photoshop       string `xml:"photoshop,attr" json:"photoshop,omitempty"`
			XmpMM           string `xml:"xmpMM,attr" json:"xmpmm,omitempty"`
			Dc              string `xml:"dc,attr" json:"dc,omitempty"`
			Tiff            string `xml:"tiff,attr" json:"tiff,omitempty"`
			Exif            string `xml:"exif,attr" json:"exif,omitempty"`
			XmpRights       string `xml:"xmpRights,attr" json:"xmprights,omitempty"`
			Iptc4xmpCore    string `xml:"Iptc4xmpCore,attr" json:"iptc4xmpcore,omitempty"`
			Iptc4xmpExt     string `xml:"Iptc4xmpExt,attr" json:"iptc4xmpext,omitempty"`
			CreatorTool     string `xml:"CreatorTool"`                                // ELE-L29 10.0.0.168(C431E2...
			ModifyDate      string `xml:"ModifyDate"`                                 // 2020-01-01T17:28:23.89961...
			CreateDate      string `xml:"CreateDate"`                                 // 2020-01-01T17:28:23
			MetadataDate    string `xml:"MetadataDate"`                               // 2020-01-01T17:28:23.89961...
			Rating          string `xml:"Rating"`                                     // 4
			FStopFavorite   string `xml:"http://www.fstopapp.com/xmp/ favorite,attr"` // 1
			Lens            string `xml:"Lens"`                                       // HUAWEI P30 Rear Main Came...
			LensModel       string `xml:"LensModel"`                                  // HUAWEI P30 Rear Main Came...
			DateCreated     string `xml:"DateCreated"`                                // 2020-01-01T17:28:25.72962...
			ColorMode       string `xml:"ColorMode"`                                  // 3
			ICCProfile      string `xml:"ICCProfile"`                                 // sRGB IEC61966-2.1
			AuthorsPosition string `xml:"AuthorsPosition"`                            // Maintainer
			DocumentID      string `xml:"DocumentID"`                                 // 2C678C1811D7095FD79CC822B...
			InstanceID      string `xml:"InstanceID"`                                 // 2C678C1811D7095FD79CC822B...
			Format          string `xml:"format"`                                     // image/jpeg
			Title           struct {
				Text string `xml:",chardata" json:"text,omitempty"`
				Alt  struct {
					Text string `xml:",chardata" json:"text,omitempty"`
					Li   struct {
						Text string `xml:",chardata" json:"text,omitempty"` // Night Shift / Berlin / 20...
						Lang string `xml:"lang,attr" json:"lang,omitempty"`
					} `xml:"li" json:"li,omitempty"`
				} `xml:"Alt" json:"alt,omitempty"`
			} `xml:"title" json:"title,omitempty"`
			Creator struct {
				Text string `xml:",chardata" json:"text,omitempty"`
				Seq  struct {
					Text string `xml:",chardata" json:"text,omitempty"`
					Li   string `xml:"li"` // Michael Mayer
				} `xml:"Seq" json:"seq,omitempty"`
			} `xml:"creator" json:"creator,omitempty"`
			Description struct {
				Text string `xml:",chardata" json:"text,omitempty"`
				Alt  struct {
					Text string `xml:",chardata" json:"text,omitempty"`
					Li   struct {
						Text string `xml:",chardata" json:"text,omitempty"` // Example file for developm...
						Lang string `xml:"lang,attr" json:"lang,omitempty"`
					} `xml:"li" json:"li,omitempty"`
				} `xml:"Alt" json:"alt,omitempty"`
			} `xml:"description" json:"description,omitempty"`
			Subject struct {
				Text string `xml:",chardata" json:"text,omitempty"`
				Bag  struct {
					Text string   `xml:",chardata" json:"text,omitempty"`
					Li   []string `xml:"li"` // desk, coffee, computer
				} `xml:"Bag" json:"bag,omitempty"`
				Seq struct {
					Text string   `xml:",chardata" json:"text,omitempty"`
					Li   []string `xml:"li"` // desk, coffee, computer
				} `xml:"Seq" json:"seq,omitempty"`
			} `xml:"subject" json:"subject,omitempty"`
			Rights struct {
				Text string `xml:",chardata" json:"text,omitempty"`
				Alt  struct {
					Text string `xml:",chardata" json:"text,omitempty"`
					Li   struct {
						Text string `xml:",chardata" json:"text,omitempty"` // This is an (edited) legal...
						Lang string `xml:"lang,attr" json:"lang,omitempty"`
					} `xml:"li" json:"li,omitempty"`
				} `xml:"Alt" json:"alt,omitempty"`
			} `xml:"rights" json:"rights,omitempty"`
			ImageWidth    string `xml:"ImageWidth"`  // 3648
			ImageLength   string `xml:"ImageLength"` // 2736
			BitsPerSample struct {
				Text string `xml:",chardata" json:"text,omitempty"`
				Seq  struct {
					Text string   `xml:",chardata" json:"text,omitempty"`
					Li   []string `xml:"li"` // 8
				} `xml:"Seq" json:"seq,omitempty"`
			} `xml:"BitsPerSample" json:"bitspersample,omitempty"`
			PhotometricInterpretation string `xml:"PhotometricInterpretation"` // 2
			Orientation               string `xml:"Orientation"`               // 0
			SamplesPerPixel           string `xml:"SamplesPerPixel"`           // 3
			YCbCrPositioning          string `xml:"YCbCrPositioning"`          // 1
			XResolution               string `xml:"XResolution"`               // 72/1
			YResolution               string `xml:"YResolution"`               // 72/1
			ResolutionUnit            string `xml:"ResolutionUnit"`            // 2
			Make                      string `xml:"Make"`                      // HUAWEI
			Model                     string `xml:"Model"`                     // ELE-L29
			ExifVersion               string `xml:"ExifVersion"`               // 0210
			FlashpixVersion           string `xml:"FlashpixVersion"`           // 0100
			ColorSpace                string `xml:"ColorProfile"`              // 1
			ComponentsConfiguration   struct {
				Text string `xml:",chardata" json:"text,omitempty"`
				Seq  struct {
					Text string   `xml:",chardata" json:"text,omitempty"`
					Li   []string `xml:"li"` // 1, 2, 3, 0
				} `xml:"Seq" json:"seq,omitempty"`
			} `xml:"ComponentsConfiguration" json:"componentsconfiguration,omitempty"`
			CompressedBitsPerPixel string `xml:"CompressedBitsPerPixel"` // 95/100
			PixelXDimension        string `xml:"PixelXDimension"`        // 3648
			PixelYDimension        string `xml:"PixelYDimension"`        // 2736
			DateTimeOriginal       string `xml:"DateTimeOriginal"`       // 2020-01-01T17:28:23
			ExposureTime           string `xml:"ExposureTime"`           // 20000000/1000000000
			FNumber                string `xml:"FNumber"`                // 180/100
			ExposureProgram        string `xml:"ExposureProgram"`        // 2
			ISOSpeedRatings        struct {
				Text string `xml:",chardata" json:"text,omitempty"`
				Seq  struct {
					Text string `xml:",chardata" json:"text,omitempty"`
					Li   string `xml:"li"` // 200
				} `xml:"Seq" json:"seq,omitempty"`
			} `xml:"ISOSpeedRatings" json:"isospeedratings,omitempty"`
			ShutterSpeedValue string `xml:"ShutterSpeedValue"` // 298973/10000
			ApertureValue     string `xml:"ApertureValue"`     // 1695994/1000000
			BrightnessValue   string `xml:"BrightnessValue"`   // 0/1
			ExposureBiasValue string `xml:"ExposureBiasValue"` // 0/10
			MaxApertureValue  string `xml:"MaxApertureValue"`  // 169/100
			MeteringMode      string `xml:"MeteringMode"`      // 5
			LightSource       string `xml:"LightSource"`       // 1
			Flash             struct {
				Text       string `xml:",chardata" json:"text,omitempty"`
				ParseType  string `xml:"parseType,attr" json:"parsetype,omitempty"`
				Fired      string `xml:"Fired"`      // False
				Return     string `xml:"Return"`     // 0
				Mode       string `xml:"Mode"`       // 0
				Function   string `xml:"Function"`   // False
				RedEyeMode string `xml:"RedEyeMode"` // False
			} `xml:"Flash" json:"flash,omitempty"`
			FocalLength           string `xml:"FocalLength"`           // 5580/1000
			SensingMethod         string `xml:"SensingMethod"`         // 2
			FileSource            string `xml:"FileSource"`            // 3
			SceneType             string `xml:"SceneType"`             // 1
			CustomRendered        string `xml:"CustomRendered"`        // 1
			ExposureMode          string `xml:"ExposureMode"`          // 0
			WhiteBalance          string `xml:"WhiteBalance"`          // 0
			DigitalZoomRatio      string `xml:"DigitalZoomRatio"`      // 100/100
			FocalLengthIn35mmFilm string `xml:"FocalLengthIn35mmFilm"` // 27
			SceneCaptureType      string `xml:"SceneCaptureType"`      // 0
			GainControl           string `xml:"GainControl"`           // 0
			Contrast              string `xml:"Contrast"`              // 0
			Saturation            string `xml:"Saturation"`            // 0
			Sharpness             string `xml:"Sharpness"`             // 0
			SubjectDistanceRange  string `xml:"SubjectDistanceRange"`  // 0
			SubSecTime            string `xml:"SubSecTime"`            // 899614
			SubSecTimeOriginal    string `xml:"SubSecTimeOriginal"`    // 899614
			SubSecTimeDigitized   string `xml:"SubSecTimeDigitized"`   // 899614
			GPSVersionID          string `xml:"GPSVersionID"`          // 2.2.0.0
			GPSLatitude           string `xml:"GPSLatitude"`           // 52,27.5814N
			GPSLongitude          string `xml:"GPSLongitude"`          // 13,19.3099E
			GPSAltitudeRef        string `xml:"GPSAltitudeRef"`        // 1
			GPSAltitude           string `xml:"GPSAltitude"`           // 0/100
			GPSTimeStamp          string `xml:"GPSTimeStamp"`          // 2020-01-01T16:28:22Z
			Marked                string `xml:"Marked"`                // False
			WebStatement          string `xml:"WebStatement"`          // http://docs.photoprism.or...
			CreatorContactInfo    struct {
				Text        string `xml:",chardata" json:"text,omitempty"`
				ParseType   string `xml:"parseType,attr" json:"parsetype,omitempty"`
				CiAdrExtadr string `xml:"CiAdrExtadr"` // Zimmermannstr. 37
				CiAdrCity   string `xml:"CiAdrCity"`   // Berlin
				CiAdrPcode  string `xml:"CiAdrPcode"`  // 12163
				CiAdrCtry   string `xml:"CiAdrCtry"`   // Germany
				CiTelWork   string `xml:"CiTelWork"`   // +49123456789
				CiEmailWork string `xml:"CiEmailWork"` // hello@photoprism.org
				CiUrlWork   string `xml:"CiUrlWork"`   // https://photoprism.org/
			} `xml:"CreatorContactInfo" json:"creatorcontactinfo,omitempty"`
			PersonInImage struct {
				Text string `xml:",chardata" json:"text,omitempty"`
				Bag  struct {
					Text string `xml:",chardata" json:"text,omitempty"`
					Li   string `xml:"li"` // Gopher
				} `xml:"Bag" json:"bag,omitempty"`
			} `xml:"PersonInImage" json:"personinimage,omitempty"`
		} `xml:"Description" json:"description,omitempty"`
	} `xml:"RDF" json:"rdf,omitempty"`
}

XmpDocument represents an XMP sidecar file.

func (*XmpDocument) Artist

func (doc *XmpDocument) Artist() string

Artist returns the XMP document artist.

func (*XmpDocument) CameraMake

func (doc *XmpDocument) CameraMake() string

CameraMake returns the XMP document camera make name.

func (*XmpDocument) CameraModel

func (doc *XmpDocument) CameraModel() string

CameraModel returns the XMP document camera model name.

func (*XmpDocument) Copyright

func (doc *XmpDocument) Copyright() string

Copyright returns the XMP document copyright info.

func (*XmpDocument) Description

func (doc *XmpDocument) Description() string

Description returns the XMP document description.

func (*XmpDocument) Favorite

func (doc *XmpDocument) Favorite() bool

Favorite returns a favorite status in the XMP document.

func (*XmpDocument) Keywords

func (doc *XmpDocument) Keywords() string

Keywords returns the XMP document keywords.

func (*XmpDocument) LensModel

func (doc *XmpDocument) LensModel() string

LensModel returns the XMP document lens model name.

func (*XmpDocument) Load

func (doc *XmpDocument) Load(filename string) error

Load parses an XMP file and populates document values with its contents.

func (*XmpDocument) TakenAt

func (doc *XmpDocument) TakenAt(timeZone string) time.Time

TakenAt returns the XMP document taken date.

func (*XmpDocument) Title

func (doc *XmpDocument) Title() string

Title returns the XMP document title.

Jump to

Keyboard shortcuts

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