External Icon File Glitchy?

Started by Darius1968, April 11, 2024, 05:26:22 PM

Previous topic - Next topic

Darius1968

The file attachment - located at this path on my SSD:  C:\__OLD-PC\D\_00\IMatch Databases\2021\Icons-Favorites - is a 64px x 64px png file that I'm trying to use as a custom icon for one of my automation favorites, which I've also added to the file window toolbar.  

It works when I first set it up, but henceforth, after I reopen the database again, it fails to be displayed on the toolbar, and I have to hover my mouse pointer over the item in my favorites panel for the display of the icon to be rendered in just that panel.  And, even then, this is erratic.  Is this a bug? 

Mario

I have a number of favorites with external icons in my daily driver database.
They all work, with regular old toolbars and the experimental ribbons, for a long time.

Do you have experimental features enabled?
Does IMatch log any warnings in debug logging mode related to favorites and icons?
Search the for CIMFavIconCache: failed to load
Maybe store the icon in a different folder, e.g. "Pictures" and load it from there? Just in case Windows or your virus checker kick in...?
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Darius1968

I have just found out that (at least for my setup) having experimental features enabled is the culprit - The display of the custom icon is fine once I turn that off. 

I've attached the debug-mode-log-file (database loaded with experimental features on). 
CIMFavIconCache: failed to load is not an entry in this log file. 

Mario

#3
It works here with either mode. I use experimental mode on my workstation and legacy toolbars on my laptop, with the same database and favorites.

So far no other user has reported this issue. But I don't know if the users with experimental features enabled use custom icons for favorites in the File Window ribbon.

Your log shows no issues with loading the png icon.
And I understand that the button exists in the File Window ribbon, but the icon is not rendered. Did you try another PNG file? How have you configured the ribbon (height setting), is the ribbon wrapped into multiple rows? What happens if you resize the File Window a bit?
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Darius1968

Yes, I have tried other png files, with the same result. 

Ribbon height has been set at 54.  I just now set it to 31 in the preferences - No change. 

Adjusting the file window size and whether or not the ribbon takes up multiple rows make no difference. 

Also, closing out all panels makes no difference. 

Mario

No idea.
I use favs with external icons in my toolbar and ribbon for a long time, never had any issue.

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

Darius1968

#6
FWIW, as I've already said, when I reopen the database, to my dismay, the icon I specify isn't displaying in the file window toolbar (with experimental features active).  I can, however, reinstate it by (1) opening up the favorites panel, (2) right-clicking the favorite and Clipboard>Copy, (3) right-click and Paste.  At this point, if I delete only the original favorite and do nothing to the copy, the icon is reinstated again on the toolbar a few seconds later... STRANGE!!!  (Of course, this lasts only for the duration that the database is open - It disappears again, after I close and reopen the database.) 

Mario

Quotethe icon is reinstated again on the toolbar a few seconds later... STRANGE!!!
This is normal. IMatch loads icons in a separate background thread, since Windows sometimes takes several seconds or more to figure out which icon belongs to an application. This would otherwise block the IMatch user interface.
Custom icons are loaded the same way, so there may be a short delay, depending on how many icons are to load and their place in the queue.

This process starts every time when you open a database.
The File Window figures out if there are favorites to show on the toolbar/ribbon and if they use the application icon, app icon, a stock icon or an external icon file. For a,b and d, the icon is scheduled to be loaded in a background thread. When the thread has loaded an icon, it notifies the File Window and the File Window refreshes the toolbar/ribbon. The process is the same, for regular toolbars and ribbons.

Your log shows no error loading icons so this seems to work just fine. At this time, I have no idea why the icon does not show on the ribbon. I cannot reproduce this and so I cannot do anything about it at this time.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Darius1968

I didn't mean that it was strange that it took a few seconds for the icon to be rendered; I thought it strange that I had to 'reinstate' it after I reopened the database. 

What could be going on that I'm able to 'jump start' things by my copy/paste operation?  Maybe, the log shows no errors, but something must be interfering in the process of opening the database, and that something isn't present whenever I paste the new copy? 

Mario

I have no idea and no repro case to analyze this further. All this is very simple and the only log entry happens when the attempt to load an external icon fails. I suggest you use one of the standard icons available for favorites.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Darius1968

I should add that this problem is not about that specific database - I created a brand new database, wherein (I) can demonstrate this same problem.  Is there anything third-party about the new file window toolbar?  I'm just trying to determine if there is something that a third-party app might not like about a certain installation. 

Mario

Ribbons are my code.

I even went as far as installing IMatch 2023.8.6 on a fresh Windows 11 installation in a VM.
Added two favorites with external icons (one in the "Pictures" folder, on in "c:\data\icons") and added both icons to the toolbar/ribbon. It works flawlessly with either toolbar or ribbon. Closing and re-opening IMatch restores the icons. No problems at all.

Image1.jpg
External icons used for favorites for a fresh IMatch 2023.8.6 installation on a clean Windows 11.

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

Mario

Any further info on this?
Maybe settings you use for ribbons, workflow etc?

I've tried to reproduce it a couple of times on different computers and in VM's but I could not make it fail. There are no related reports from other users, so this might be something that only fails on your system.

If I cannot reproduce it, I will close this bug report.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Darius1968

#13
On my end, at the moment, in the Favorites panel, if I associate a favorite with one of the IMatch icons, that icon displays all the time.  Contrast that to when I associate a favorite with an image file of my choosing (located on any storage media) - Here, the thumbnail for the image file only displays if I hover my mouse pointer over the favorite in question.  (Yes, this scenario is also true for the case in which I have experimental features turned off, allowing the icon to display on the file window toolbar.)  Otherwise, the thumbnail is just a black image icon.  So, could this phenomena be related to a registry setting or something? 

Mario

#14
No idea. IMatch asks Windows to figure out the application icon or IMatch loads the custom icon in the background. When the icon / image is available, IMatch receives a notification, updates the ribbon button and redraws the ribbon / toolbar to show the new icon.

I will add more logging output to the code. Maybe this tells us why this fails on your computer in the next release.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Darius1968


Mario

Quote from: Darius1968 on April 21, 2024, 09:05:22 AMThanks for looking into it. 
Don't get your hopes up.
The current logging logs all errors encountered while loading shell icons, app store icons or external icons. We did not see any error message in your logs. All I can do is add logging for successful loading of icons and for receiving the "a new icon has been loaded in the background, update toolbar/ribbon". Maybe this tells me something.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Darius1968

And, so, with the latest release of IMatch, I have yet attached another log file (debug-mode, of course!). 

Everything about the problem is the same as outlined above, except for one addition: 
I've found that I can get the external-favorite-icon to enumerate if I simply add a new favorite - It can be anything, even just a placeholder.  Which I can then delete the favorite I just added, and the icon will stay enumerated. 

I did what I outlined in the above paragraph for the new log file that I've attached here.  Hopefully, this sheds some new light on the situation.  I should conclude by mentioning that, in the meantime, I have used the newly added feature of Windows 11 to reinstall the operating system, while keeping the data in  tact. 

Mario

Looks perfectly normal to me.

IMatch enqueues:
- C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Zoom Player\Zoom Player MAX.lnk
- 'C:\__OLD-PC\D\_00\IMatch Databases\2021\Icons-Favorites\New Window.png'

and reports

- external icon 'C:\__OLD-PC\D\_00\IMatch Databases\2021\Icons-Favorites\New Window.png' for fav ['Icons'] 'Selected Files In New Window' 'B9715B72-1AE7-4FF7-BBCA-35FCCE044856' loaded successfully.
-shell icon for fav ['Applications'] 'Zoom Player MAX' 'DB179FC7-F175-4E18-B6A3-7DB11C9631CD' loaded successfully.

FileWnd: icon loaded/updated for favorite 'B9715B72-1AE7-4FF7-BBCA-35FCCE044856'
FileWnd: icon loaded/updated for favorite 'DB179FC7-F175-4E18-B6A3-7DB11C9631CD'

The icons were enqueues, loaded in the background successfully and the File Window was notified for each icon and added it to the ribbon.

I have no idea why the icons don't show on your system. And on your system only, apparently, since I have no similar reports from other users.

Unfortunately, the additional logging entries I've added just for you don't bring any additional insight. Everything looks perfect and the icons should just show. No idea why they don't.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Darius1968

I'm just stumped!  Wonder what it could be?! 

Well, as I've said elsewhere in this post, when I define the user-supplied icon, in the Favorites panel, it displays only if I hover my mouse pointer over the favorite itself; Otherwise the placeholder for the icon is black.  Is this normal? 

Jingo

Sorry I didn't try this before but wanted to try and help so I downloaded your PNG icon and added it to a Favorite with experimental icons turned on... and I have the same exact issue.  The icon is blank except if I hover the mouse over it - then it appears... but only if I am outside the favorite "boxes".. if I move the cursor between two favorites, the icon box appears but it is black/empty. 

I attached a small GIF file to demonstrate... hopefully this helps! - Andy.


Darius1968

Jingo, thanks for your input on this!  Are you having the same issue as me, in not having the icon display in the file window toolbar when IMatch and the database are first opened, unless you take some of the steps that I've already outlined in this post, like adding/deleting a new placeholder? 

Mario

I have a different effect, but only with your "New Window.png" icon.

When I add it to a favorite, it shows in the ribbon, but not in the Favorite itself. Only when I hover over the favorite it shows:

Image4.jpg

When I close and reopen the database, it no longer shows anywhere, neither the ribbon or the Favorite itself.
In this situation, the icon is already in the global icon cache (from the previous session). It has the correct size (32x32px) and everything looks fine. But the Windows routines IMatch uses to draw the icon just output nothing.

The PNG file provided has no alpha mask, so it could also be a JPG. I saved the New Window.png to  JPG file, and it produces the same effect (!). No show in the Fav Panel but shows in the ribbon.
Closing and re-opening the database also makes it vanish from the ribbon, despite the icon still being loaded and cached.
Opening the Properties for the favorite and clicking OK forces IMatch to clear the global icon cache, making it reload the icon from disk again. The icon now shows in the ribbon. But not in the favorite itself.

For me, with your icon, the Favorite is always blank. Except when I move the mouse into the Favorite, which makes the icon show. The interesting bit is that the icon is always drawn in the same way, only the background is drawn with different (highlight) colors when the mouse cursor is in the favorite.

Solution

Your New Window.png is a PNG file with 300 DPI and no alpha channel. Which is unusual.
Re-saving it as a JPG or PNG in Photoshop did not change the result.
Then I made a 64 x 64 image in Photoshop (also with 300 DPI) and loaded your PNG file. I used Ctrl+A to select the image in your PNG file and pasted it into the new 64x64 pixel file I created. Then I saved it as PNG.

And that worked!

The icon now shows in the Favorite and in the ribbon.
Closing and reopening the database has no effect, the icon still shows in the ribbon and the favorite.

My guess is that the missing or corrupted alpha channel in your original file is somehow messing with the AlphaBlend* Windows functions IMatch uses to render icons with transparency. In some weird ways.

I have attached the "new" icon I've created in Photoshop below.
Please use that and the problem should be solved.

I don't know which software you've used to create the original PNG. If you have more of these icons, I recommend you do what I did to fix the obscure issue.
I guess it's the missing/corrupted alpha channel, but I don't know for sure. But then I wonder how can this problem survive when I re-save the PNG to a JPG file? JPG files have no alpha channel, so why does this also fail. There must be some real weird image data in the original file.

Anyway, enough time wasted on this. Use the icon I've created for you and it will work just fine.




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

Jingo

I didn't think to check the PNG to see if it had a Alpha mask.. very nice find!!  I confirmed this corrected the issue on my system.

Darius1968

Thanks for the find, Mario.  I was wondering if it could have had something to do with the file.