a repo of http://vocaro.com/trevor/blog/2009/10/12/resize-a-uiimage-the-right-way/