BMP image does not read correctly anymore. (Issue #24219)

45 views
Skip to first unread message

dsa-t

unread,
Jan 15, 2024, 10:53:26 AM1/15/24
to wx-...@googlegroups.com, Subscribed

A specific BMP image does not read correctly anymore.

Here's how the image is supposed to look like:

image.png (view on web)

Most colors are replaced with transparency when loaded by wx and saved as png:

image.png (view on web)

Original table.bmp and the result saved in png is in the archive:
image.zip

Platform and version information

  • wxWidgets version you use: 3.3 (8967bed)
  • wxWidgets port you use: wxGTK
  • OS and its version: Linux Mint 21.1


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/24219@github.com>

paulcor

unread,
Jan 15, 2024, 12:05:36 PM1/15/24
to wx-...@googlegroups.com, Subscribed

Can be seen with the image sample on MSW, so not GTK-specific.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/24219/1892528110@github.com>

AliKet

unread,
Jan 15, 2024, 12:22:32 PM1/15/24
to wx-...@googlegroups.com, Subscribed

Can be seen with the image sample on MSW, so not GTK-specific.

The same with wxQt! so this is definitely not GTK-specific.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/24219/1892549752@github.com>

Randalphwa

unread,
Jan 15, 2024, 1:45:54 PM1/15/24
to wx-...@googlegroups.com, Subscribed

Placing the BMP file into the richtext sample just shows a black box (run on Windows 11). The BMP does display correctly when loaded into Windows 11 Paint. It does not display correctly in Affinity Photo 2, Affinity Designer 2, or Topaz Sharpen AI. It does display correctly in HTML Help Image Editor which has not been updated since 1999 -- so while the BMP format might be unusual enough to throw off the commercial products I tried it on, it's a format that was at least understandable 25 years ago.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/24219/1892639342@github.com>

PB

unread,
Jan 15, 2024, 1:53:14 PM1/15/24
to wx-...@googlegroups.com, Subscribed

A specific BMP image does not read correctly anymore

The image by the OP is on Windows displayed by the image sample in grayscale (i.e., incorrectly) from wxWidgets 3.0.5 to the (almost) current GIT master (tested also many versions in between, including 3.2.x and bunch of 3.1.x), so it is not a recent thing, at least on MSW.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/24219/1892645958@github.com>

dsa-t

unread,
Jan 15, 2024, 2:15:14 PM1/15/24
to wx-...@googlegroups.com, Subscribed

so it is not a recent thing, at least on MSW.

You're right. I was looking at wrong data.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/24219/1892666744@github.com>

dsa-t

unread,
Jan 15, 2024, 3:04:02 PM1/15/24
to wx-...@googlegroups.com, Subscribed

Does the image have alpha or not?

It doesn't seem like it's supposed to have alpha. GIMP doesn't import an alpha channel with it.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/24219/1892711588@github.com>

PB

unread,
Jan 15, 2024, 3:28:22 PM1/15/24
to wx-...@googlegroups.com, Subscribed

FWIW, I have tried a bunch of programs on Windows 10 and they all displayed the image in color:
FireFox and Chrome, GIMP, Corel PhotoPAINT, Inkscape, IrfanView, Total Commander, Paint, Paint 3D, Photos, Snip&Sketch, Libre Office and Microsoft Office.

The only program that displayed the image with transparency was web-based Photopea.

So I think, the problem is not with the image but wxWidgets. I also tried the image sample from wxWidgets 2.8.12 and it has issues to display the image at all, so...


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/24219/1892732372@github.com>

paulcor

unread,
Jan 15, 2024, 7:13:44 PM1/15/24
to wx-...@googlegroups.com, Subscribed

The file loads correctly on Windows using wxBitmap::LoadFile(), which uses WIN32 LoadFile(). I think the issue here is that despite the depth being 32, Windows (and most other software) only uses the RGB values and not the alpha. Maybe the alpha is only used if the file has an "extended" header, like BITMAPV4HEADER.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/24219/1892898421@github.com>

paulcor

unread,
Jan 16, 2024, 10:37:58 AM1/16/24
to wx-...@googlegroups.com, Subscribed

Actually, I think the alpha is only used if BITMAPINFOHEADER.biCompression == BI_BITFIELDS.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/24219/1893996343@github.com>

Reply all
Reply to author
Forward
0 new messages