how to resize image comming from Xml Feed
I am getting image from Xml feed and then displaying it in table cell what I want to do is to resize image to minimum size of 5kb my code is.
int blog开发者_如何学编程EntryIndex1 = [indexPath indexAtPosition: [indexPath length] -1];
imgstring=[[blogEntries objectAtIndex: blogEntryIndex1] objectForKey: @"image"];
NSURL *url = [NSURL URLWithString:imgstring];
NSData *data = [NSData dataWithContentsOfURL:url];
UIImage *img = [[UIImage alloc] initWithData:data];
cell.imageView.image=[img autorelease];
Thanks In Advance.
Try this if it helps :
CGSize itemSize = CGSizeMake(kAppIconWidth, kAppIconHeight);
UIGraphicsBeginImageContext(itemSize);
CGRect imageRect = CGRectMake(0.0, 0.0, itemSize.width, itemSize.height);
[image drawInRect:imageRect];
self.cell.image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
精彩评论