an optimized implementation that also scales and caches at the size of the UIImage