Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 39 additions & 4 deletions resources/images/exif/exif.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,17 @@ type ExifInfo struct {
// Image creation date/time.
Date time.Time

// A collection of the available Exif tags for this Image.
// A collection of the available Exif, Iptc and Xmp tags for this Image.
Tags Tags

// A collection of the available Exif tags for this Image.
Exif Tags

// A collection of the available Iptc tags for this Image.
Iptc Tags

// A collection of the available Xmp tags for this Image.
Xmp Tags
}

type Decoder struct {
Expand Down Expand Up @@ -193,7 +202,6 @@ func (d *Decoder) Decode(filename string, format imagemeta.ImageFormat, r io.Rea
ImageFormat: format,
ShouldHandleTag: shouldInclude,
HandleTag: handleTag,
Sources: imagemeta.EXIF, // For now. TODO(bep)
Warnf: warnf,
},
)
Expand All @@ -210,17 +218,44 @@ func (d *Decoder) Decode(filename string, format imagemeta.ImageFormat, r io.Rea
}

tags := make(map[string]any)
for k, v := range tagInfos.All() {

tagsXmp := make(map[string]any)
for k, v := range tagInfos.XMP() {
if d.shouldExclude(k) {
continue
}
if !d.shouldInclude(k) {
continue
}
tagsXmp[k] = v.Value
tags[k] = v.Value
}

tagsIptc := make(map[string]any)
for k, v := range tagInfos.IPTC() {
if d.shouldExclude(k) {
continue
}
if !d.shouldInclude(k) {
continue
}
tagsIptc[k] = v.Value
tags[k] = v.Value
}

tagsExif := make(map[string]any)
for k, v := range tagInfos.EXIF() {
if d.shouldExclude(k) {
continue
}
if !d.shouldInclude(k) {
continue
}
tagsExif[k] = v.Value
tags[k] = v.Value
}

ex = &ExifInfo{Lat: lat, Long: long, Date: tm, Tags: tags}
ex = &ExifInfo{Lat: lat, Long: long, Date: tm, Tags: tags, Exif: tagsExif, Iptc: tagsIptc, Xmp: tagsXmp}

return
}
Expand Down