Details
-
Bug
-
Resolution: Fixed
-
P3: Somewhat important
-
6.5.0
-
None
-
-
1079b5373 (dev), 31a3e82b7 (6.6), 8b20f5c21 (6.5), 8a8dc88d7 (tqtc/lts-5.15)
Description
QImageReader/ICOReader does not read the AND mask for 24bpp icon entries in .ico files, causing some icons to have opaque pixels that are supposed to be transparent. Qt uses the same codepath for 32-bit icons as it does 24-bit icons, because icoAttrib.depth is folded to 32 for 16, 24 and 32-bit icons.
The logic is here:
if (icoAttrib.depth == 32) { img = std::move(image).convertToFormat(QImage::Format_ARGB32_Premultiplied); } else { QImage mask(image.width(), image.height(), QImage::Format_Mono); if (!mask.isNull()) { mask.setColorCount(2); mask.setColor(0, qRgba(255,255,255,0xff)); mask.setColor(1, qRgba(0 ,0 ,0 ,0xff)); read1BitBMP(mask); if (!mask.isNull()) { img = image; img.setAlphaChannel(mask); } } }
I think that icoAttrib.depth == 32 should possibly be icoAttrib.nbits == 32. This would still use the alpha channel when it is available, but otherwise, it will correctly read the mask.
Attached is an example of an icon with such a problem, extracted from a program called HookShark. It works with most other software that reads .ico files, including GIMP, and I believe most (all?) versions of Windows that support 24bpp icons.
Attachments
For Gerrit Dashboard: QTBUG-113319 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
490729,1 | Fix transparency in 16 bit and 24 bit ico files | tqtc/lts-6.2 | qt/tqtc-qtbase | Status: NEW | +2 | 0 |