I want to resize a bitmap for a project that I am doing. I managed to do this by converting the cgbitmapcontextref to a pixel array and then manipulating the array of pixels and then generated a new image from the manipulated pixel data. This way is extremely cumbersome.
I want to know if there is any other way to resize a CGBitmapContextRef. Thanks.
If you're not wed to
CGBitmapContextRef, here are some UIKit-based simple image resizing routines. This extension offers resizes images by either cropping, scaling, aspect filling, and aspect fitting (analogous to a few of the main content modes that UIImageView offers).For Swift 2 rendition, see previous revision of this answer.