Consider the code: Sub TestGraphicBitsPerPixel Dim oProps(0) As New com.sun.star.beans.PropertyValue oProps(0).Name = "URL" oProps(0).Value = "https://bug-attachments.documentfoundation.org/attachment.cgi?id=177261" oProvider = createUnoService("com.sun.star.graphic.GraphicProvider") oGraphic = oProvider.queryGraphic(oProps()) MsgBox oGraphic.BitsPerPixel End Sub It uses attachment 177261 [details] (that is simply a small PNG having 24 BPP), and the expected output would be 24; but the actual result is "True". The problem is implementation of BitsPerPixel property (documented to have 'byte' UNO type) [1] in vcl/source/graphic/UnoGraphicDescriptor.cxx, where the UNO type is defined as cppu::UnoType< sal_uInt8 > [2]. But that type maps to TypeClass::BOOLEAN [3], which makes Basic to convert the non-0 value to True. The actual type that maps to TypeClass::BYTE is cppu::UnoType< sal_Int8 >. The problem was since the introduction of the code in commit 7e83653a7fac894bee2c7c35fa2b84daac026642; there also was GraphicType property using that type initially, but that was fixed in commit 0170d51253bddd1e8ec1c8c887b526f2fc18d019. The code that sets the numeric value to the property [4] uses the correct sal_Int8 type. The fix of this easyhack should contain a unit test. [1] https://api.libreoffice.org/docs/idl/ref/servicecom_1_1sun_1_1star_1_1graphic_1_1GraphicDescriptor.html#ac99c505108bd7f6220e43c3f7a7a9040 [2] https://opengrok.libreoffice.org/xref/core/vcl/source/graphic/UnoGraphicDescriptor.cxx?r=912b8fa6#241 [3] https://api.libreoffice.org/docs/idl/ref/namespacecom_1_1sun_1_1star_1_1uno.html#a00683ed3ec24b47c36ead10a20d6f328a8a583f16e8d237a423c8c1d9087a4c72 [4] https://opengrok.libreoffice.org/xref/core/vcl/source/graphic/UnoGraphicDescriptor.cxx?r=912b8fa6#381
https://gerrit.libreoffice.org/c/core/+/151597
Hi @Oleg, this bug has been ASSIGNED to you for more than 6 months. Do you plan to keep working on a fix for it? If not, please change the bug status back to NEW. Thanks!
Adam Seskunas committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/9071cd6e59fb98ad8a2ddfb1019eaf950c716722 tdf#149714 BitsPerPixel property of Graphic has Boolean UNO type It will be available in 24.8.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.