Shrank memory requirements of upng, no longer runs out of memory.  Changed uint32_t to uint16_t where applicable in upng.c.
Added automatic max image detection back in.