PNG Icons

This forum can be used to talk about general design strategies, new ideas and questions in general related to wxWidgets. If you feel your questions doesn't fit anywhere, put it here.
Post Reply
MrRage
Knows some wx things
Knows some wx things
Posts: 35
Joined: Fri Mar 11, 2005 3:43 am

PNG Icons

Post by MrRage » Fri Mar 11, 2005 5:12 pm

I found some really cool looking png icons online and I wanted to encorperate them into my program. The problem is when I used photoshop to convert the png's to bmp's it stenceled the alpha layer and didn't blend them. If anyone has an idea how I could have alpha blending with PNG icons that would be a really big help.

btw: I found these icons here, could come in handy for anyone else looking for xp like icons.
http://www.eggheadcafe.com/free_graphic ... sp?start=1

eco
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 203
Joined: Tue Aug 31, 2004 7:06 pm
Location: Behind a can of Mountain Dew
Contact:

Post by eco » Mon Mar 14, 2005 6:54 am

I use PNGs with an alpha channel for icons just fine. Normally I embed the PNG directly in my source (kind of like an XPM) but you could load straight from a file. wxWidgets handles the alpha very well, particularly in the 2.5.x series. Now, if you mean an actual Windows icon (a .ico file), they don't support alpha (at least, I've never heard or been able to get them to).

krysa
Experienced Solver
Experienced Solver
Posts: 71
Joined: Wed Feb 16, 2005 9:23 pm
Location: Lithuania

Post by krysa » Mon Mar 14, 2005 8:34 am

eco wrote:I use PNGs with an alpha channel for icons just fine. Normally I embed the PNG directly in my source (kind of like an XPM) but you could load straight from a file. wxWidgets handles the alpha very well, particularly in the 2.5.x series. Now, if you mean an actual Windows icon (a .ico file), they don't support alpha (at least, I've never heard or been able to get them to).
Windows icon (.ico) file supports alpha. It's just, most of the developers first makes a bitmap (.bmp) file wich doesn't support alpha, then converts it to the windows icon (.ico) file, thus icon file doesn't have alpha information, because bitmap file didn't. If you want your icon (.ico) file to have alpha you must make it from the format that suopports it (.png, .gif, .tga etc.). For such conversions i'd recomend programs like IrfanView32 or XnView - they are both free (maybe opensource - not sure), and they both supports manny formats. My personal preference is XnView (it supports more formats).
Also, developer(s) of XnView has also made a command line tool for converting between formats (you can find it on theyr page) so if you want to make a custom build step for converting images - this is the best way to go (IMHO).

Note: XnView (and the command line tool) supports XPM and similar formats - it can make a C source code for images so you can simply include it in your code (never tryed it myself, but i suppose it is possible).

EDIT
-----------------------
Links:
XnView - http://www.xnview.com
NConvert (command line tool) - http://www.xnview.com
PS: They are not open source.
Platform: MSW (Windows XP Pro)
Compiler: msvc 13.10.3077 (Free Toolkit)
wxWidgets: v2.6.0

krysa
Experienced Solver
Experienced Solver
Posts: 71
Joined: Wed Feb 16, 2005 9:23 pm
Location: Lithuania

Post by krysa » Sun Apr 03, 2005 1:32 pm

eco wrote:I use PNGs with an alpha channel for icons just fine. Normally I embed the PNG directly in my source (kind of like an XPM) but you could load straight from a file. wxWidgets handles the alpha very well, particularly in the 2.5.x series. Now, if you mean an actual Windows icon (a .ico file), they don't support alpha (at least, I've never heard or been able to get them to).
Can you tell us (me) more about how you embed PNG files like XPM files in your source? Is there a tool that converts PNG into C source? Or maybe you wrote your own tool? Please write some more about this.
Thanks.
Platform: MSW (Windows XP Pro)
Compiler: msvc 13.10.3077 (Free Toolkit)
wxWidgets: v2.6.0

Cursor
Earned some good credits
Earned some good credits
Posts: 120
Joined: Sun Aug 29, 2004 3:09 pm
Location: Grenoble, France
Contact:

Post by Cursor » Sun Apr 03, 2005 2:50 pm

krysa wrote:Windows icon (.ico) file supports alpha. It's just, most of the developers first makes a bitmap (.bmp) file wich doesn't support alpha, then converts it to the windows icon (.ico) file, thus icon file doesn't have alpha information, because bitmap file didn't.
It was true before windows XP.
.ico and .bmp are the same structure but wx use it incorrectly : some ico file (and bmp) with alpha chanel are usually readen incorrectly.

Post Reply