vimiv-qt icon indicating copy to clipboard operation
vimiv-qt copied to clipboard

Vimiv Metadata Keys

Open jcjgraf opened this issue 4 years ago • 1 comments

As briefly mentioned in #321, it would be useful to to be able to display some information about the image file in the metadata widget, which are not part of exif (or only part for some formats). Concretely, it would be useful to be able to get the imageformat, X and Y dimension in pixels and the file size.

To integrate this information into the metadata widget, probably the easiest option would be to add some special keys, which are e.g. prefixed by Vimiv.<key>. In imutils.exif.ExifHandler we would have to filter these options before submitting the keys to exiv2 and handle them separately.

The advantage of this approach is that these additional information is well integrated into the metadata widget, meaning that no extra command or something is required to display them.

Open questions:

  • What keys would be useful to have? I have so far come up with:
    • Vimiv.ImageFormat: Image extension (JPEG, CR2 etc.)
    • Vimiv.XDimension: Length of image in pixels
    • Vimiv.YDimension: Height of image in pixels
    • Vimiv.FileSize: The file size in MB
  • Should imutils.exif.ExifHandler be renamed to imutils.metadata.MetadataHandler (or something similar) since the handler deals with exif, iptc and general metadata.

What do you think @karlch? Do you have a better idea for an implementation?

jcjgraf avatar Jan 21 '21 13:01 jcjgraf

I like the idea of having additional "internal" keys, but I am not sure I like mixing this with the ExifHandler directly. The code is already quite involved there. I am fine with renaming the handler though, as you say also iptc is supported.

Personally, I would prefer to have all of this split into different chunks, maybe something like:

  • The exif / metadata handler that we have currently to deal with regular keys
  • Some function / class / module to deal with vimiv keys
  • Some class that combines the two and delegates the work accordingly

Careful thinking would be especially important if the vimiv keys require accessing the current pixmap to retrieve the pixel size as I would really like to keep exif and qt pixmaps as separate as possible. The more I think about this the more afraid I am of possible code coupling, but I may be overthinking and should probably wait for some actual coding :laughing:

What do you think? Do you want to take a shot at this?

karlch avatar Jan 21 '21 20:01 karlch