Display number of keywords in thumbnails

Started by pajaro, August 28, 2014, 10:31:03 PM

Previous topic - Next topic

pajaro

This feature request is related to this thread: https://www.photools.com/community/index.php?topic=3244.0.

It would be useful if feature that counts the number of keywords assigned to an image and then displays this number in the thumbnail is implemented. To avoid potential performance issues with large number of displayed files it may not be updated automatically but only when requested by the user.

Mario

This is actually already implemented. I remembered how to do it, but found it not working.
So I fixed the bug for version 5.1.16 and then you can use simply:

{File.Categories|filter:^@Keywords;count:true}

The filter returns all categories with names starting with @Keywords. And the count function returns the number of elements found.

The count function was not working, must have been broken a while ago when adding/fixing support for regular expressions. Works again in 5.1.16.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

pajaro

Quote from: Mario on August 29, 2014, 10:41:36 AM
This is actually already implemented. I remembered how to do it, but found it not working.
So I fixed the bug for version 5.1.16 and then you can use simply:

{File.Categories|filter:^@Keywords;count:true}

The filter returns all categories with names starting with @Keywords. And the count function returns the number of elements found.

The count function was not working, must have been broken a while ago when adding/fixing support for regular expressions. Works again in 5.1.16.

Thanks a lot, it will be perfect!

sinus

Thanks, Mario,
this variable works now.

I tried it, but, what I fully understand, on my system the speed is remarkable slower. I can scroll the thumbs easy, but when I add the variable {File.Categories|filter:^@Keywords;count:true} than the scrolling is very slow.

This is surely not a problem or bug, I think, IMatch must calculate so mutch, that it makes it simply slower.

So, we can decide, if we want include this in a thumbnail layout or not. You have mentioned somewhere, that every variable counts of course some speed, some variables does it more, other less.
Best wishes from Switzerland! :-)
Markus

pajaro

Quote from: sinus on September 04, 2014, 08:51:54 AM
Thanks, Mario,
this variable works now.

I tried it, but, what I fully understand, on my system the speed is remarkable slower. I can scroll the thumbs easy, but when I add the variable {File.Categories|filter:^@Keywords;count:true} than the scrolling is very slow.

This is surely not a problem or bug, I think, IMatch must calculate so mutch, that it makes it simply slower.

So, we can decide, if we want include this in a thumbnail layout or not. You have mentioned somewhere, that every variable counts of course some speed, some variables does it more, other less.

Mario, I also want to thank you, the feature works nicely. I have a similar experience as Markus with the speed of IMatch, though. If number of @Keywords is shown in the thumbnails, IMatch becomes very slow. This is understandable because there is a lot of calculations involved. I thought that IMatch would need to calculate the numbers of @Keywords just once and then store the results in cache but every time IMatch is started calculations start again. I found a workaround: I modified one of the Apps and it now displays assigned @Keywords and their numbers, but of course just for the file in focus which makes things much faster.

Mario

Quote from: sinus on September 04, 2014, 08:51:54 AM
Thanks, Mario,
this variable works now.

I tried it, but, what I fully understand, on my system the speed is remarkable slower. I can scroll the thumbs easy, but when I add the variable {File.Categories|filter:^@Keywords;count:true} than the scrolling is very slow.

This is surely not a problem or bug, I think, IMatch must calculate so mutch, that it makes it simply slower.

So, we can decide, if we want include this in a thumbnail layout or not. You have mentioned somewhere, that every variable counts of course some speed, some variables does it more, other less.

This is to be expected!
Especially if your database has many keywords, and your's has probably thousands.

Just think about what IMatch has to do: For every thumbnail in the file window it has to:

a) Find all categories beginning with @Keywords, which can be thousands! And this means evaluate thousands of regular expressions...
b) Find all categories within the result which contain the current file
c) Calculate the number of these categories

IMatch calculates the information to display on a thumbnail when the thumbnail is loaded, so scrolling will cause the entire machinery to run, unless the data has already been cached. Quite expensive.

If you want to pay the price or is up to you.
You can always create a separate file window layout which shows this information, and use that only when you really need to know how many keywords each and every file has assigned.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

sinus

Quote from: Mario on September 04, 2014, 10:06:43 AM
You can always create a separate file window layout which shows this information, and use that only when you really need to know how many keywords each and every file has assigned.

Ha, that is a good idea! Thanks.
Best wishes from Switzerland! :-)
Markus

Mario

For build 5.2.4 I have added support for the count formatting function also for repeatable variables, e.g., keywords. This allows you to use variables like

{File.MD.XMP::Lightroom\hierarchicalSubject\HierarchicalSubject\0|count:true}

to display the number of keywords assigned to a file.

This may be much faster than using the Categories.Direct|filter:^@Keywords... variable to count the number of keywords assigned to a file.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

sinus

Thanks, Mario

I will try this variable, as soon the new version is out!  :)
Best wishes from Switzerland! :-)
Markus

sinus

And yep, it works.
The speed, unfortunately I cannot test now, because I have only 10 images in the db!  8)
(But the formating of varibables is great, works like a charm, I think, I mentioned it already  ;) )
Best wishes from Switzerland! :-)
Markus

pajaro

Quote from: Mario on September 07, 2014, 08:05:17 AM
For build 5.2.4 I have added support for the count formatting function also for repeatable variables, e.g., keywords. This allows you to use variables like

{File.MD.XMP::Lightroom\hierarchicalSubject\HierarchicalSubject\0|count:true}

to display the number of keywords assigned to a file.

This may be much faster than using the Categories.Direct|filter:^@Keywords... variable to count the number of keywords assigned to a file.

I have just tested it in 5.2.4. - just AMAZING  :), very fast, exactly what I hoped for  :) . Thanks a million, Mario.

Mario

I thought as much.

Loading the metadata of a file (which is often cached in memory anyway) and counting the ; in the string is much faster than running thousands of regular expressions in order to find all categories starting with @Keywords.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

sinus

Quote from: pajaro on September 08, 2014, 07:36:57 PM

I have just tested it in 5.2.4. - just AMAZING  :), very fast, exactly what I hoped for  :) . Thanks a million, Mario.

Cool, Pajaro!
So, I think the speed is fine also for me. I must say, for example the formated variables with name.ext is, also with 200'000 images really VERY fast!
Also the Attributes - tag.
And now also the keyword-variable. So we can build a very good, individual thumb-region!

I attach a thumb where the number 18 in the red rectangle is the keyword-count, the doc is the format and the ATT is the hint, that this files has acutally some attributes - entry.

The layout is not finnished yet, because I have not too much time and second, I have still to lern and play with some formating-issues.

For example specialy in this case, when the file is not an image, the displayed 0x0 and so on are not wanted, I will try to replace them with some other text, like instead of 0.00 cm x 0.00 cm I want display "A4" (but will be difficult to check, if it is A5 or A4 and so on) or at least "Text-Dok" or something equal.

Have fun!



[attachment deleted by admin]
Best wishes from Switzerland! :-)
Markus

pajaro

Quote from: sinus on September 08, 2014, 08:11:04 PM

I attach a thumb where the number 18 in the red rectangle is the keyword-count, the doc is the format and the ATT is the hint, that this files has acutally some attributes - entry.

The layout is not finnished yet, because I have not too much time and second, I have still to lern and play with some formating-issues.

For example specialy in this case, when the file is not an image, the displayed 0x0 and so on are not wanted, I will try to replace them with some other text, like instead of 0.00 cm x 0.00 cm I want display "A4" (but will be difficult to check, if it is A5 or A4 and so on) or at least "Text-Dok" or something equal.

Have fun!


Hi Markus,

You made a very nice layout  :) . Mine is not so advanced, it shows just the number of @Keywords (yellow number at the bottom), but I managed to change the color and the font. From your layout I see that there is still so much I have to learn! The new function is extremely useful for me, I am so glad that Mario implemented it.

Good luck!

Pavel.

[attachment deleted by admin]

Mario

Quote from: pajaro on September 08, 2014, 11:05:06 PM
The new function is extremely useful for me, I am so glad that Mario implemented it.

That's real support!
Spread the word. Let others know about IMatch  :D
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Mario

-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

pajaro

Quote from: Mario on September 13, 2014, 03:18:54 PM
This inspired me for today's know-how article:

Facebook: https://www.facebook.com/photools

web site: http://www.photools.com/3324/fun-with-file-window-layouts/

Very nice  :). I was testing other formatting functions you posted but for some reason I was not able to display all keywords. I used the variable you showed ({File.MD.XMP::Lightroom\hierarchicalSubject\HierarchicalSubject\0|replace:~;==, }, I copy/pasted it to avoid any typo) but got just empty row. Any idea?

Mario

{File.MD.XMP::Lightroom\hierarchicalSubject\HierarchicalSubject\0|replace:~;==, }

Works here. Did you try it in the App panel? Does the file have keywords?
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

pajaro

Quote from: Mario on September 16, 2014, 06:51:29 PM
Does the file have keywords?

It doesn't, tried it with a wrong file... :-[ :-[ :-[

Anyway, with other files it works perfectly, thanks a lot!

BTW, my keywords are hierarchical. Is there any way how to display them flattened?

Mario

What do you mean with "display flattened"?
IMatch flattens your keywords according to the options you have configured into the XMP-dc:Subject tag. The hierarchicalSubject tag is by definition hierarchical.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

pajaro

Quote from: Mario on September 16, 2014, 07:27:41 PM
What do you mean with "display flattened"?
IMatch flattens your keywords according to the options you have configured into the XMP-dc:Subject tag. The hierarchicalSubject tag is by definition hierarchical.

Sorry, I did not use correct wording. What I mean is to display e.g. John, instead of Family|Son|John. The only reason is that showing hierarchy takes too much space and the keywords will not fit the thumbnail. In the Keyword panel, there is an option of either showing, or not showing hierarchy; for thumbnails I was asking for option of not showing hierarchy.

jch2103

See the Help for Variables; look for 'leaf'.
John

Mario

If you only want to display the leaf level (bottom level) of your keywords, you cannot use the hierarchicalSubject variable. You can access the @Keywords category hierarchy and display the leaf level:

{File.Categories|filter:^@Keywords;level:leaf}

Note that this is a rather slow variable (because of the regular expression so you might not want to use this in the file window. If you use the search function here in the community you'll find many other cool uses of variables, @Keywords etc. Use the App Panel to try things out for yourself, to get acquainted with IMatch variables.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

pajaro


Quote from: jch2103See the Help for Variables; look for 'leaf'.

Quote from: Mario on September 16, 2014, 08:19:27 PM
If you only want to display the leaf level (bottom level) of your keywords, you cannot use the hierarchicalSubject variable. You can access the @Keywords category hierarchy and display the leaf level:

{File.Categories|filter:^@Keywords;level:leaf}

Note that this is a rather slow variable (because of the regular expression so you might not want to use this in the file window. If you use the search function here in the community you'll find many other cool uses of variables, @Keywords etc. Use the App Panel to try things out for yourself, to get acquainted with IMatch variables.

Thank you both.

Mario, you are right, this option is too slow to be used on a regular basis. Moreover, for images with more keywords the text will not fit the thumbnails anyway. But never mind, it is always interesting to learn what can be done in IMatch  :).