Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 27 additions & 10 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,26 @@ func (d *Decoder) Decode(filename string, format imagemeta.ImageFormat, r io.Rea
}

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

tagsXmp := make(map[string]any)
for k, v := range tagInfos.XMP() {
tagsXmp[k] = v.Value
tags[k] = v.Value
}

tagsIptc := make(map[string]any)
for k, v := range tagInfos.IPTC() {
tagsIptc[k] = v.Value
tags[k] = v.Value
}

tagsExif := make(map[string]any)
for k, v := range tagInfos.EXIF() {
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