Get size of a UIImage (bytes length) not height and width

Kevin picture Kevin · Aug 18, 2009 · Viewed 54.6k times · Source

I'm trying to get the length of a UIImage. Not the width or height of the image, but the size of the data.

Answer

Meet picture Meet · Jan 31, 2012
 UIImage *img = [UIImage imageNamed:@"sample.png"];
 NSData *imgData = UIImageJPEGRepresentation(img, 1.0); 
 NSLog(@"Size of Image(bytes):%d",[imgData length]);