When I use this code the png file looks very white. When I load the image using GDI+ it looks normal. Is this is a problem in PB or with something else?
You can't save ICC profile info in a PNG using Photoshop. Sounds like you're better off using Photoshop on your Mac than using GIMP.
Maybe try using something like irfanview to re-save out your PNG. Maybe you can get some clues >here< (see the section "File size and optimisation software", specifically PNG chunks).
mskuma - that code shows correctly here. I've used the alphalayer of png and tiff regularly since beta 1 of PB 4 and with the exception of one early bug that was fixed months ago, never had a problem. I'd be surprised if there were a bug in the decoder.
I tried resaving it with IrfanView then it didn't show at all using my code above. It worked (but no alpha transparency) when I loaded it with GDI+.
I then tried resaving it (from the original) with Pixel. It then had that same whiteness to it. As usual, no problem when I used GDI+ for loading.
I then tried resaving it (from the original) with Corel PhotoPaint. It did not show at all. It worked (but no alpha transparency) when I loaded it with GDI+.
Since one png image works and another not, what else can be wrong than the decoder or the png files?
I could be wrong, but I think there's absolutely nothing wrong with the decoder - did you guys try the code I posted above & see netmaestro's result also? Using the 'defective' image, I could get the same result (i.e. alpha/transparency effects) as exhibited on the original web page (i.e. http://www.w3.org/Graphics/PNG/inline-alpha.html). [edit: Note that the alphatest.png image is from that page].