midora Posted September 11, 2021 Posted September 11, 2021 I'm wondering why the thumbnail of a .pdn file shows a drop shadow in FileExplorer icon views (or the preview panel). Typically just .bmps are showing the drop shadow and no other file types (on my Windows 10 laptop). Any idea/hint why this is the case for .pdn files? I would like to get it for .bmrl. I can not imagine that the drop shadow is part of the thumbnail. Because it uses exact the same colors as .bmps in dark and light mode. Does it depend on the type of registration? Quote
Rick Brewster Posted September 11, 2021 Posted September 11, 2021 Screenshot please ... Quote The Paint.NET Blog: https://blog.getpaint.net/ Donations are always appreciated! https://www.getpaint.net/donate.html
midora Posted September 11, 2021 Author Posted September 11, 2021 The files with extension .bmp and .bmrl are using my new shell extension to create the thumbnails. The 'DropShadow bmrl.bmp' file ist just a renamed copy of the 'DropShadow.bmrl' which I saved from paint.net with the bmrl filetype plugin. This 'DropShadow bmrl.bmp' is just to show that thumbnails for files with .bmp extension but .bmrl content are showing now a thumbnail. This is not the case without the shell extension for .bmp because Windos detects these .bmp not as bitmap files. Same effect in Windows light mode. So the question is, how does Windows know that .pdn should get a drop shadow but not .bmrl (latest Windows 10). Quote
Rick Brewster Posted September 12, 2021 Posted September 12, 2021 I'm not sure why it happens, I've seen it though. Could be the shell interface you're implementing, which had better be IThumbnailProvider and not whatever the ye ol' deprecated interface is from the 2K/XP days. Could be you're doing something wrong with the bitmap itself, like returning it in the wrong pixel format. I don't know. Good documentation and examples are hard to come by for this stuff. Quote The Paint.NET Blog: https://blog.getpaint.net/ Donations are always appreciated! https://www.getpaint.net/donate.html
midora Posted September 12, 2021 Author Posted September 12, 2021 We know the documentation of these COM interfaces is limited. .NET 4.0 is needed to implement the interfaces in c#. I didn't expect that a lot of people are experienced with this. But you never know. The handler uses COM IThumbnailProvider and returns BGRA (or you couldn't see through 😉 No idea what's going on there. Just the standard image format thumbnails are showing the shadow AND .pdn. It's for sure not important but I really like to understand what's going on. In the moment the code for .bmrl draws the image a little bit higher into the bitmap just to reduce the missing shadow offset effect. This way the top line of the images in all the thumbnails is adjusted (otherwise the .bmrl thumbnails would sit a bit deeper). This seems to work for all thumbnail sizes. In the moment I'm creating a InfoTipHandler to show some properties of .bmrl files. Maybe paint.net could add one to show the dimensions of the image. Quote
midora Posted September 12, 2021 Author Posted September 12, 2021 Maybe the issue is related to this comment: An implementation of this interface for photo thumbnails is supplied in Microsoft Windows as CLSID_PhotoThumbnailProvider. Applications that use the supplied implementation must define a constant CLSID identifier using the GUID {C7657C4A-9F68-40fa-A4DF-96BC08EB3551}. Quote
midora Posted September 12, 2021 Author Posted September 12, 2021 And there is this topic which hints that paint.net uses CLSID_PhotoThumbnailProvider. I have to figure out how to use it... Quote
Rick Brewster Posted September 13, 2021 Posted September 13, 2021 CLSID_PhotoThumbnailProvider handles built-in extensions like JPG and PNG. I use it in the Paint.NET shell extension so that Explorer can handle a few formats, like in case Paint.NET is registered to handle them (like when double-clicking on them) -- no need to use managed code for dealing with them, Explorer can already do it. Quote The Paint.NET Blog: https://blog.getpaint.net/ Donations are always appreciated! https://www.getpaint.net/donate.html
midora Posted September 13, 2021 Author Posted September 13, 2021 But this really sounds that if paint.net extends .bmp, ... with .pdn and all are getting the shadow then anything which uses CLSID_PhotoThumbnailProvider may be handled similar. Just have to understand how to do it for a try. Quote
null54 Posted September 13, 2021 Posted September 13, 2021 15 minutes ago, midora said: Just have to understand how to do it for a try. According to MSDN the drop shadow is provided by the OS, see https://docs.microsoft.com/en-us/windows/win32/shell/thumbnail-providers#thumbnail-adornments. 1 2 Quote Plugin Pack | PSFilterPdn | Content Aware Fill | G'MIC | Paint Shop Pro Filetype | RAW Filetype | WebP Filetype The small increase in performance you get coding in C++ over C# is hardly enough to offset the headache of coding in the C++ language. ~BoltBait
midora Posted September 13, 2021 Author Posted September 13, 2021 Thanks for the effort @null54. I just found the topic about the Treatment. Then I looked for Treatment in the registry and found HKEY_CLASSES_ROOT\SystemFileAssociations\image Key: Treatment Value: 2 (means Photo Border) Then I checked the .pdn entry and found Key: PerceivedType Value: image And that's it. Setting this key to .bmrl shows the drop shadow after a restart of the FileExplorer. That's what I expected in the beginning: There must be a kind of file category marker. Now I have to figure out how do do this using the sharpshell library. Maybe I have to patch it... Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.