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
Next Next commit
exif: Added IPTC and XMP metadata to the EXIF object
Under the Exif Tags are now all tags from every metadata category with the priority Exif > IPTC > XMP but if someone wants a specific tag from a specific category this is still possible because of the "raw" lists of tags.

\#13146
  • Loading branch information
LNA-DEV committed Mar 29, 2025
commit dbe24f0482039a2ae00b44861688c51b601beb7a
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