png transparency

I'm showing png images (16x16) in a TreeCtrl and they don't look as smooth as they could. The Window's preview from explorer? looks much better. I've put a comparison here:

http://tnr.cc/tmp/icon_compare.png

To get the bitmap, I'm doing the following:

1. create wx.Image using wx.ImageFromStream (don't always have filesystem access because of py2exe, pkg_resources, etc)

2. use wx.BitmapFromImage to create the bitmap

3. add it to a wx.ImageList instance via ImageList.Add

4. assign to TreeCtrl node via TreeCtrl.SetItemImage

What can I do to smooth this image out?

Thanks

--Randall

It's probably converting the alpha channel to a mask somewhere along the line. If you can track down where that is happening it might help solve it. It may also depend on which version of Windows and/or which version of the common controls DLL is being used, as older versions do not support using bitmaps with alpha. If all else fails you can redesign the icon to look good with a mask instead of depending on partially transparent pixels.

···

On 3/17/10 6:01 PM, Randall Smith wrote:

I'm showing png images (16x16) in a TreeCtrl and they don't look as
smooth as they could. The Window's preview from explorer? looks much
better. I've put a comparison here:

http://tnr.cc/tmp/icon_compare.png

To get the bitmap, I'm doing the following:

1. create wx.Image using wx.ImageFromStream (don't always have
filesystem access because of py2exe, pkg_resources, etc)

2. use wx.BitmapFromImage to create the bitmap

3. add it to a wx.ImageList instance via ImageList.Add

4. assign to TreeCtrl node via TreeCtrl.SetItemImage

What can I do to smooth this image out?

--
Robin Dunn
Software Craftsman