I have a .png file in my resources folder.(actual size is 411 KB) When I convert the uiimage to nsdata and try accessing length property, it gives me wrong value.
Code...
UIImage *image = [UIImage imageNamed:@"sample.png"];
NSData *imgData = [[NSData alloc] initWithData:UIImageJPEGRepresentation(image, 1.0)];
int imageSize = imgData.length;
NSLog(@"Image size in KB is %d",imageSize/1024); //-------- returns 631 KB
Please let me know if there is any other property which helps..
So here is my requirement.... I want to know the size of the image I pick from uimagepicker. The exact size of the image when I see it in the finder and the size which gets returned to me after picking it from the library is totally different... Is there any other property which can be used instead of length?