-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Description
Description
Custom folder icons that use PNG-based .ico files display with a black background instead of transparency in the sidebar and thumbnail previews. This issue does not occur with:
System .dll icons (which render correctly with transparency)
BMP-based .ico files (which also render correctly)
The black background appears specifically when icons are rendered at small scales (such as sidebar icons) or when thumbnails are scaled down using Ctrl+Scrollwheel. The issue is caused by Image.FromHbitmap() not preserving the alpha channel from PNG-based icons when converting from HBITMAP.
Root Cause of the Bug:
The issue appears to be in Win32Helper.Storage.cs in the GetBitmapFromHBitmap method. Image.FromHbitmap doesn't preserve the alpha channel for PNG-based icons, causing transparent pixels to render as black. The existing detection logic (IsAlphaBitmap) may fail for small-scale icons that don't have semi-transparent pixels.
Expected behavior:
The custom folder icon should display with proper transparency, showing no black background.
Actual behavior:
The custom folder icon displays with a black background where transparency should be, particularly in the sidebar and when thumbnails are scaled to smaller sizes.
Note:
I know this issue is related/similar to issue #14993 but this is a variant is for custom .ico (PNG-based) files.
Steps To Reproduce
- Create a custom folder icon using a PNG-based
.icofile (not BMP-based) - Apply the custom icon to a folder using folder properties
- Pin that same folder to the sidebar
- Observe the folder icon in the sidebar
Files Version
4.0.21.0
Windows Version
10.0.22631.6199
User ID
7f792b8e-49e5-4005-b360-0e98745a13d0
Log File
Metadata
Metadata
Assignees
Labels
Type
Projects
Status