i am stuck in one problem i am creating image and it size is arounf 350*350 but i want to resize that image into small image like 32*32 or 16*16 i am doing that with this code
UIImage *scaledImage=img_Clip;
UIGraphicsBeginImageContextWithOptions(CGSizeMake(16, 16),NO,0.0);
// Turn off interpolation to keep the scaled image from being blurred.
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetInterpolationQuality(context, kCGInterpolationHigh);
[scaledImage drawInRect:CGRectMake(0, 0, 16, 16)]; // scales image to rect
UIImage *resImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
But i dont get the desired result my image become blurry i tried many thing but nothing work kindly help me
What you can do is to create a UIImageView
using your un-scaled UIImage
and then change the frame.size of the image view. This will automatically scale down your image. Hopefully without making your image blurry.
UIImageView *imageView = [UIImageView initWithImage:unscaledImage];
imageView.frame = CGRectMake(0,0,16,16); // change the size of the image view
Give it a try.
Hope this helps.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.