detect ico type

@sdsykes @jcheatham

The issue I ran into is that based on this article:

http://en.wikipedia.org/wiki/ICO_(file_format)

"Specifies image height in pixels. Can be any number between 0 and 255. Value 0 means image height is 256 pixels."

Which means I had to do some craziness.