wxImage from PNG with an alpha channel

Apparently, the wxImage.HasAlpha() function is lying to me most of the
time. That is, only for some PNG files with transparency. Also, method
wxImage.GetOrFindMaskColour() returns a 3-tuple, even for files that do
read correctly ! This is baffling since alpha values singular in PNG
RGBA files. When reading does work, it works well. It’s a go/no-go
situation which seems semi-random depending on the particular file.

` self.wxImage = wx.Image( ‘TRY.PNG’, wx.BITMAP_TYPE_PNG )

    hasAlpha = self.wxImage.HasAlpha()

`

File
“C:\PROGRA~1\Python25\lib\site-packages\wx-2.8-msw-unicode\wx_core.py”,

line 2829, in GetAlpha

return core.Image_GetAlpha(*args, **kwargs)

wx._core.PyAssertionError: C++ assertion “HasAlpha()” failed at
…\src\common

\image.cpp(1643) in wxImage::GetAlpha(): no alpha channel

Have I smacked into a bug, or perhaps a known shortcoming ? Is there
another way to get images to always handle detecting the alpha channel
properly ?

I have attached 2 small images and the code file.

Platform Windows 6.1.7600

Python 2.5.4 (r254:67916, Dec 23 2008, 15:10:54) [MSC v.1310 32 bit
(Intel)]

Python wx 2.8.10.1

WIN7 64-bit

TRY.PNG

SMALL_PIC.PNG

···


To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en