0
votes

I got a NSData, and I want to convert it to UIImage with custom height and width. I know the way that use CGContextDrawImage or drawInRect to get resized image from CGContextRef. But it's too slow, Can I get a fast way to do that? thanks

1

1 Answers

0
votes

use this to get image from NSData:-

UIImage *img=[UIImage imageWithData:data];

If you want to make a thumbnail of a UIImage (with proportional resizing or maybe some cropping involved), check out UIImage+Resize category that allows you to use concise, ImageMagick-like syntax:

UIImage* squareImage       = [image resizedImageByMagick: @"320x320#"];