gramps icon indicating copy to clipboard operation
gramps copied to clipboard

Image Meta Viewer - expand support for IPTC, XMP and Named regions with Thumbnails

Open brucejackson opened this issue 3 years ago • 19 comments

  • Expand support in image metadata viewer for XMP and IPTC metadata
  • Display thumbnails of Named Regions in the metadata viewer

brucejackson avatar Jun 10 '21 13:06 brucejackson

Codecov Report

Merging #1263 (47a9343) into maintenance/gramps51 (670bb35) will decrease coverage by 0.04%. The diff coverage is 0.00%.

:exclamation: Current head 47a9343 differs from pull request most recent head d7c9a0d. Consider uploading reports for the commit d7c9a0d to get more accurate results Impacted file tree graph

@@                   Coverage Diff                    @@
##           maintenance/gramps51    #1263      +/-   ##
========================================================
- Coverage                 41.94%   41.90%   -0.05%     
========================================================
  Files                      1066     1066              
  Lines                    145104   145277     +173     
========================================================
+ Hits                      60868    60873       +5     
- Misses                    84236    84404     +168     
Impacted Files Coverage Δ
gramps/plugins/gramplet/metadataviewer.py 0.00% <0.00%> (ø)
gramps/plugins/lib/libmetadata.py 0.00% <0.00%> (ø)
gramps/gui/uimanager.py 15.48% <0.00%> (-0.33%) :arrow_down:
gramps/grampsapp.py 0.00% <0.00%> (ø)
gramps/gui/clipboard.py 0.00% <0.00%> (ø)
gramps/gui/viewmanager.py 0.00% <0.00%> (ø)
gramps/gui/views/pageview.py 0.00% <0.00%> (ø)
gramps/plugins/rel/rel_nl.py 0.00% <0.00%> (ø)
gramps/plugins/view/geofamily.py 0.00% <0.00%> (ø)
gramps/gen/datehandler/_date_nl.py 41.59% <0.00%> (ø)
... and 7 more

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 670bb35...d7c9a0d. Read the comment docs.

codecov-commenter avatar Jan 20 '22 17:01 codecov-commenter

One thing I would do is increase the row height for people tags when a person's thumbnail is displayed. I don't like the face being cut off. Any ideas, on how I can specify the row height in the view for specific rows?

image

brucejackson avatar Jan 21 '22 12:01 brucejackson

Perhaps you could download Chris Horn's experimental LinkedView (Browse View) add-on and see how the Media viewer handles thumbnail allocation? (The Photo Tagging Gramplet also specifies a thumbnail height in a row and would be less code to look through.)

The following image show both add-ons but is a snapshot of when the LinkedView add-on was a Relationships view mode instead of a whole new view: https://github.com/cdhorn/LinkedView/blob/master/images/LinkedViewMediaSidebar.png

I plan to download your mods & see how this addon works in combination.

(Hoping to eventually find something that will let me see marquee rectangles & a GUI to numerically tweak sizes & order. And something that looks at sidecar files plus possibly converting a sidecar to embedded data.)

emyoulation avatar Jan 21 '22 13:01 emyoulation

Any ideas, on how I can specify the row height in the view for specific rows?

Check that the fixed-height-mode for the TreeView is set to False.

treeview.set_fixed_height_mode(False)

Nick-Hall avatar Jan 21 '22 14:01 Nick-Hall

I don't think reading sidecar data within Gramps will be possible. I don't see any methods in GExiv2 (https://lazka.github.io/pgi-docs/GExiv2-0.10/classes/Metadata.html). Though it does have the ability to save to sidecar files. ExifTool will let you batch embed the data from sidecar files (https://exiftool.org/forum/index.php?topic=4659.msg22238#msg22238)

I was thinking that the rectangles (named regions) should maybe be added to the image preview tab as a separate feature.

Reordering and resizing probably is probably possible. It would fit better in the Edit Metadata Gramplet.

I will check out the linked view.

brucejackson avatar Jan 21 '22 14:01 brucejackson

Chris put in a Configuration 3-state options for thumbnails: off, small & large. Come to think of it, there are left & right options too.

He separated options for People vs. Media thumbnails too.

emyoulation avatar Jan 21 '22 14:01 emyoulation

treeview.set_fixed_height_mode(False)

Thanks, Nick. That will get me started. It works on the first image, but once the row height is expanded that row height remains expanded until I restart gramps. I'll see what I can learn to help correct this.

image

brucejackson avatar Jan 21 '22 15:01 brucejackson

After swapping in the files to 5.1.4 (I expected it wouldn't work with 5.1.4 and that I needed to be using the master. Just haven't gotten there yet.), the following error is reported.

2022-01-21 16:24:32.464: WARNING: dummydb.py: line 1428: database is closed
2022-01-21 16:24:41.689: WARNING: _manager.py: line 308: Plugin error (from 'editexifmetadata'): cannot import name 'format_datetime'
2022-01-21 16:24:41.689: WARNING: grampletpane.py: line 181: Error loading gramplet 'Edit Image Exif Metadata': skipping content

emyoulation avatar Jan 21 '22 22:01 emyoulation

Thanks, I've fixed what I broke with this commit 9700ac9. You should be able to get the latest version and be running again.

brucejackson avatar Jan 21 '22 22:01 brucejackson

Rebased onto master branch.

Nick-Hall avatar Mar 15 '22 18:03 Nick-Hall

Thank you for the feedback and help!

On Sat, 19 Mar 2022, at 18:21, Nick Hall wrote:

@.**** commented on this pull request.

In gramps/plugins/lib/libmetadata.py https://github.com/gramps-project/gramps/pull/1263#discussion_r830533256:

                 self.model.tree.expand_all()
                 retval = self.model.count > 0
         except:
             pass

     return retval
  • def __add_section(self, section):
  • def add_section(self, section):

Thanks. It looks good now.

— Reply to this email directly, view it on GitHub https://github.com/gramps-project/gramps/pull/1263#discussion_r830533256, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJJTVIS42RQAQGD73OW7MDVAZHODANCNFSM46OP73DA. You are receiving this because you authored the thread.Message ID: @.***>

brucejackson avatar Mar 19 '22 22:03 brucejackson

@brucejackson Can we have an option to display the user friendly tag names that the previous version had?

ExifMetadata

Do you also have time to add a region to one of our example files? The "Yawn" image already has some Exif tags, but you could choose another image.

Nick-Hall avatar Mar 20 '22 23:03 Nick-Hall

Hi, sorry for dropping in late to the party.

I'm trying to find where in the sqlite.db Corner 1 (X, Y) and Corner 2 (X, Y) from the Media Reference Editor are stored?

  • From the data model (https://www.gramps-project.org/wiki/index.php/Gramps_Data_Model) I tend to believe it is not stored in the db.
  • From the thumb folder I tend to believe that a cropped copy of the original image is stored.

Are my assumptions correct?

hklaufus avatar Mar 21 '22 14:03 hklaufus

In the data model it is in the 'rect' tuple part of the MediaRef. Unfortunately if looking at the sqlite db it is buried in a blob for one of the primary objects (like person, or event etc.) and thus is difficult to decode/view. The MediaRef objects are in a 'media_list' of the media references of each of these primary objects.

prculley avatar Mar 21 '22 15:03 prculley

@prculley : super, thanks. Overlooked that one.

hklaufus avatar Mar 21 '22 15:03 hklaufus

Can we have an option to display the user-friendly tag names that the previous version had?

What do you think about showing the namespace and the user-friendly label rather than an option? It looks cleaner than just showing the tag and provide more context than just showing the label.

image

brucejackson avatar Mar 21 '22 16:03 brucejackson

Do you also have time to add a region to one of our example files? The "Yawn" image already has some Exif tags, but you could choose another image

I do have time and I started to do this when I noticed some of the sample images referencing www[dot]uglypeople[dot]com and that is when I stopped. I didn't want my name attached to editing images from a site feel the site was in poor taste and is now a porn site. I then considered that I don't know where the other images are from.

Might it make some sense to look for new images, licensed for Creative Commons, or whatever scheme is appropriate for the Gramps Project?

brucejackson avatar Mar 21 '22 16:03 brucejackson

I agree. I was starting the same process when I saw that domain & pulled back.

However, maybe we can combine 2 tasks in one? We're having to develop stencils for icon theme purposes. Maybe we could integrate the metadata into some files that will be distributed with Gramps anyway? Screenshot_20220321-121935.png

emyoulation avatar Mar 21 '22 17:03 emyoulation

What do you think about showing the namespace and the user-friendly label rather than an option?

Yes, that's fine. I didn't want to lose anything from the previous version.

Might it make some sense to look for new images, licensed for Creative Commons, or whatever scheme is appropriate for the Gramps Project?

I totally agree. We don't want to be associated with such a website.

Nick-Hall avatar Mar 21 '22 19:03 Nick-Hall

Testing should involve creating a test file with all the tags that can be displayed by this gramplet and then checking the output.

A copy of gramps/images/splash.jpg would be a good choice of test file. This could then be added to our example family tree.

Nick-Hall avatar Oct 19 '22 14:10 Nick-Hall

https://github.com/gramps-project/gramps/blob/master/images/splash.jpg

Image is of Robert Allingham, great-grandfather of Gramps creator, Don Allingham. (Robert Allingham, Sr. 1886 Monorhamilton, Ireland - 1968 Pittsburgh, Pennsylvania, USA)

Reference: Gramps Developer maillist: reply by Don Allingham on 26 Feb 2009 in thread "re:GRAMPS website"

emyoulation avatar Oct 19 '22 15:10 emyoulation

I'm questioning if my proposed change should go forward, given the different approach (and better approach) that is being taken by @metadata in the DisplayMetadata plugin - https://gramps.discourse.group/t/0012219-expand-imagemetadata-gramplet-to-support-xmp-and-iptc-metadata-tags/1240/34?u=ebj075.

If the packaging issues can be resolved, I think it is a better long-term approach to metadata. Exiftool from what I see has more metadata support than exiv2. The DisplayMetadata gramplet is reporting all metadata in a file rather than making somewhat educated guesses about which fields are important.

It also doesn't make sense to me to have 2 gramplets that are so similar.

On Wed, 19 Oct 2022, at 10:29, Nick Hall wrote:

Testing should involve creating a test file with all the tags that can be displayed by this gramplet and then checking the output.

A copy of gramps/images/splash.jpg would be a good choice of test file. This could then be added to our example family tree.

— Reply to this email directly, view it on GitHub https://github.com/gramps-project/gramps/pull/1263#issuecomment-1284111003, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJJTVPLRWQASCP4YBCCPXLWEAAWJANCNFSM46OP73DA. You are receiving this because you were mentioned.Message ID: @.***>

brucejackson avatar Oct 19 '22 16:10 brucejackson

Rebased.

Nick-Hall avatar Jul 04 '23 21:07 Nick-Hall

I'm questioning if my proposed change should go forward, given the different approach (and better approach) that is being taken by @metadata in the DisplayMetadata plugin.

There seems to be no progress made with the DisplayMetadata plugin. For Gramps, exiv2 is more convenient than exiftool and we already package it.

I think that this is ready to merge as it offers a clear benefit over the existing plugin. @brucejackson Are you happy for me to go ahead with this? We plan to release v5.2 at the end of July.

Nick-Hall avatar Jul 04 '23 22:07 Nick-Hall

Yes - that's fine.

On Tue, 4 Jul 2023, at 18:03, Nick Hall wrote:

I'm questioning if my proposed change should go forward, given the different approach (and better approach) that is being taken by @metadata https://github.com/metadata in the DisplayMetadata plugin.

There seems to be no progress made with the DisplayMetadata plugin. For Gramps, exiv2 is more convenient than exiftool and we already package it.

I think that this is ready to merge as it offers a clear benefit over the existing plugin. @brucejackson https://github.com/brucejackson Are you happy for me to go ahead with this? We plan to release v5.2 at the end of July.

— Reply to this email directly, view it on GitHub https://github.com/gramps-project/gramps/pull/1263#issuecomment-1620787015, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJJTVN6WQVFLPL63QNUC6TXOSHMFANCNFSM46OP73DA. You are receiving this because you were mentioned.Message ID: @.***>

brucejackson avatar Jul 05 '23 13:07 brucejackson