Fix possible RTE in ResetMenuIcons

Thanks to RR for reporting.  I can't reproduce the problem, which
concerns me a bit, but it's easy enough to fix it without knowing the
root cause...
Fix ICC profile handling of exotic PNG types

Non-24bpp PNGs with embedded ICC profiles should now work properly.
Thanks to Herman Liu for the test images that helped me track down
mistakes in my profile detection code.