Im using images from my iphone library in an app.The following method work well but my problem is when I then archive the image using NSData. When the image is unarchived later on the UIImage size reverts back to the original size?
NSData *data = [[NSData alloc]init];
UIImage *reducedImage = [self imageWithImage:selectedImage scaledToSize:CGSizeMake(50,50)];
data = [NSKeyedArchiver archivedDataWithRootObject:reducedImage];
and here the method Im using;
- (UIImage *)imageWithImage:(UIImage *)image scaledToSize:(CGSize)newSize {
UIGraphicsBeginImageContext(newSize);
UIGraphicsBeginImageContextWithOptions(newSize, NO, 0.0);
[image drawInRect:CGRectMake(0, 0, newSize.width, newSize.height)];
UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return newImage;
}