Documentation
¶
Overview ¶
Package xmp provides functions for decoding .xmp sidecar files and XMP embedded within image files
Index ¶
- Variables
- func CleanXMPSuffixWhiteSpace(buf []byte) []byte
- type Attribute
- func (p Attribute) Is(p1 xmpns.Property) bool
- func (p Attribute) Name() xmpns.Name
- func (p Attribute) Namespace() xmpns.Namespace
- func (p Attribute) Parent() xmpns.Property
- func (p Attribute) Property() xmpns.Property
- func (p *Attribute) SetParent(parent xmpns.Property)
- func (attr Attribute) String() string
- func (p Attribute) Value() []byte
- type Aux
- type Basic
- type CRS
- type Double
- type DublinCore
- type Exif
- type Flash
- type History
- type Tag
- type Tiff
- type XMP
- type XMPMM
Constants ¶
This section is empty.
Variables ¶
var ( // Reader errors ErrNoValue = errors.New("error property has no value") ErrNegativeRead = errors.New("error negative read") ErrBufferFull = bufio.ErrBufferFull )
var ( // ErrNoXMP is returned when no XMP Root Tag is found. ErrNoXMP = errors.New("xmp: error no XMP Tag found") ErrPropertyNotSet = errors.New("xmp: error property not set") // DebugMode when true would print items not parsed in XMP DebugMode = false )
Common Errors
Functions ¶
func CleanXMPSuffixWhiteSpace ¶
CleanXMPSuffixWhiteSpace returns the same slice with the whitespace after "</x:xmpmeta>" removed.
Types ¶
type Attribute ¶
type Attribute struct {
// contains filtered or unexported fields
}
Attribute is an xmp Attribute
type Aux ¶
type Aux struct {
SerialNumber string
LensInfo string
Lens string
LensID uint32
LensSerialNumber string
ImageNumber uint16
ApproximateFocusDistance string // rational
FlashCompensation meta.ExposureBias // rational
Firmware string
}
Aux attributes of an XMP Packet. These are Adobe-defined auxiliary EXIF tags. This implmentation is incomplete and based on https://exiftool.org/TagNames/XMP.html#aux
type Basic ¶
type Basic struct {
// The date and time the resource was created. For a digital file, this need not match a
// file-system creation time. For a freshly created resource, it should be close to that time,
// modulo the time taken to write the file. Later file transfer, copying, and so on, can make the
// file-system time arbitrarily different.
CreateDate time.Time `xml:"CreateDate"`
// The name of the first known tool used to create the resource.
CreatorTool string `xml:"CreatorTool"`
// A word or short phrase that identifies a resource as a member of a user-defined collection.
Label string `xml:"Label,attr"`
// The date and time that any metadata for this resource was last changed.
// It should be the same as or more recent than xmp:ModifyDate.
MetadataDate time.Time `xml:"MetadataDate,attr"`
// The date and time the resource was last modified.
ModifyDate time.Time `xml:"ModifyDate,attr"`
// A user-assigned rating for this file. The value shall be -1 or in the range [0..5],
// where -1 indicates “rejected” and 0 indicates “unrated”. If xmp:Rating is not present,
// a value of 0 should be assumed.
Rating int8 `xml:"Rating,attr"`
}
Basic - the XMP basic namespace contains properties that provide basic descriptive information. XMP spec Section 8.4 xmlns:xmp="http://ns.adobe.com/xap/1.0/"
type CRS ¶
type CRS struct {
RawFileName string
}
CRS is Camera Raw Settings. Photoshop Camera Raw namespace tags.
xmlns:crs="http://ns.adobe.com/camera-raw-settings/1.0/"
This implementation is incomplete and based on https://exiftool.org/TagNames/XMP.html#crs
type DublinCore ¶
type DublinCore struct {
// An entity responsible for making contributions to the resource
// Examples of a contributor include a person, an organization, or a service.
// Typically, the name of a contributor should be used to indicate the entity.
// XMP usage is a list of contributors. These contributors should not include those listed in dc:creator.
Contributor []string `xml:"contributor"`
// The spatial or temporal topic of the resource, the spatial applicability of the resource,
// or the jurisdiction under which the resource is relevant.
// XMP usage is the extent or scope of the resource.
Coverage string `xml:"coverage"`
// An entity primarily responsible for making the resource.
// Examples of a creator include a person, an organization, or a
// service. Typically, the name of a creator should be used to indicate the entity.
// XMP usage is a list of creators. Entities should be listed in order of decreasing precedence,
// if such order is significant.
Creator []string `xml:"creator"`
// A point or period of time associated with an event in the life cycle of the resource.
Date time.Time `xml:"date"`
// An account of the resource.
// XMP usage is a list of textual descriptions of the content of the resource, given in various languages.
Description []string `xml:"description"`
// XMP usage is a MIME type.
Format imagetype.ImageType `xml:"format"`
// An unambiguous reference to the resource within a given context.
Identifier string `xml:"identifier"`
// A language of the resource.
// XMP usage is a list of languages used in the content of the resource.
// TODO - RDFSeq is a guess
Language []string `xml:"language"`
// An entity responsible for making the resource available
// Examples of a publisher include a person, an organization, or a
// service. Typically, the name of a publisher should be used to indicate the entity.
// XMP usage is a list of publishers.
// TODO - RDFSeq is a guess
//Publisher RDFSeq `xml:"publisher"`
// A related resource.
// Recommended best practice is to identify the related resource
// by means of a string conforming to a formal identification system.
// XMP usage is a list of related resources.
// TODO - RDFSeq is a guess
//Relation RDFSeq `xml:"relation"`
// Information about rights held in and over the resource.
// typically, rights information includes a statement about various property
// rights associated with the resource, including intellectual property rights.
// XMP usage is a list of informal rights statements, given in various languages.
// TODO - RDFAlt is a guess
Rights []string `xml:"rights"`
// A related resource from which the described resource is derived.
// The described resource may be derived from the related resource in whole or in part.
// Recommended best practice is to identify the related resource by means of a string
// conforming to a formal identification system.
Source string `xml:"source"`
// The topic of the resource.
// Typically, the subject will be represented using keywords, key phrases, or
// classification codes. Recommended best practice is to use a controlled vocabulary.
// To describe the spatial or temporal topic of the resource, use the dc:coverage element.
// XMP usage is a list of descriptive phrases or keywords that specify the content of the resource.
Subject []string `xml:"subject"`
// A name given to the resource.
// Typically, a title will be a name by which the resource is formally known.
// XMP usage is a title or name, given in various languages.
Title []string `xml:"title"`
TitleLang []string
}
DublinCore is the "dc:" namespace often seen in xmp meta. https://en.wikipedia.org/wiki/Dublin_Core http://dublincore.org For the XMP flavour, see XMP section 8.3
xmlns:dc="http://purl.org/dc/elements/1.1/"
type Exif ¶
type Exif struct {
ExifVersion string
PixelXDimension uint32
PixelYDimension uint32
DateTimeOriginal time.Time
CreateDate time.Time // Exif:DateTimeDigitized
ExposureTime meta.ShutterSpeed
ExposureProgram meta.ExposureProgram
ExposureMode meta.ExposureMode
ExposureBias meta.ExposureBias
ISOSpeedRatings uint32
Flash Flash
MeteringMode meta.MeteringMode
Aperture meta.Aperture
FocalLength meta.FocalLength
SubjectDistance float32
GPSLatitude float64
GPSLongitude float64
GPSAltitude float32
GPSTimestamp time.Time
}
Exif attributes of an XMP Packet.
Exif 2.21 or later: xmlns:exifEX="http://cipa.jp/exif/1.0/" Exif 2.2 or earlier: xmlns:exif="http://ns.adobe.com/exif/1.0/"
This implementation is incomplete and based on https://exiftool.org/TagNames/XMP.html#exif
type Flash ¶
Flash represents exif:Flash Based on: https://exiftool.org/TagNames/XMP.html
type History ¶
type History struct {
Changed string
Action string
InstanceID meta.UUID
Date time.Time
Software string // softwareAgent
}
History is an XMPMM History sequence
type Tag ¶
type Tag struct {
// contains filtered or unexported fields
}
Tag is an xmp Tag
type Tiff ¶
type Tiff struct {
Make string // Camera Make
Model string // Camera Model
Software string
Copyright []string
ImageDescription []string
ImageWidth uint16
ImageLength uint16
Orientation meta.Orientation
}
Tiff attributes of an XMP Packet.
xmlns:tiff="http://ns.adobe.com/tiff/1.0/"
This implementation is incomplete and based on https://exiftool.org/TagNames/XMP.html#tiff
type XMP ¶
type XMP struct {
Aux Aux // xmlns:aux="http://ns.adobe.com/exif/1.0/aux/"
Exif Exif // xmlns:exifEX="http://cipa.jp/exif/1.0/" and xmlns:exif="http://ns.adobe.com/exif/1.0/"
Tiff Tiff // xmlns:tiff="http://ns.adobe.com/tiff/1.0/"
Basic Basic // xmlns:xmp="http://ns.adobe.com/xap/1.0/"
DC DublinCore // xmlns:dc="http://purl.org/dc/elements/1.1/"
CRS CRS
MM XMPMM
}
XMP contains the XML namespaces represented
type XMPMM ¶
type XMPMM struct {
// DocumentId is the common identifier for all versions and renditions of a resource.
DocumentID meta.UUID
// InstanceId is an identifier for a specific incarnation of a resource,
// updated each time a file is saved.
InstanceID meta.UUID
// OriginalDocumentId is the common identifier for the original resource from which the current
// resource is derived. For example, if you save a resource to a different format,
// then save that one to another format, each save operation should generate a new
// xmpMM:DocumentID that uniquely identifies the resource in that format,
// but should retain the ID of the source file here.
OriginalDocumentID meta.UUID
History []History
PreservedFileName string
}
XMPMM - The XMP Media Management namespace contains properties that provide information regarding the identification, composition, and history of a resource. XMP spec Section 8.6 Incomplete