我有两种方法,都给出了错误的答案。
NSMutableArray *img=[[NSMutableArray alloc]init];
img=[memoInstance getTempImagesToSend]; //get nsmutableArray of images
NSData* myEncodedImageData=[img objectAtIndex:0];
NSLog(@"IMAGE1:%@",[UIImage imageWithData:myEncodedImageData]); //i see image
NSLog(@"len:%lu",(unsigned long)[myEncodedImageData length]); //first way to show size
NSData *imgData = UIImageJPEGRepresentation([UIImage imageWithData:myEncodedImageData], 1);
NSLog(@"Size of Image(bytes):%d",[imgData length]); //second way to show
第一种方式:len:34898
第二种方式:Size of Image(bytes):47701
图片来自相册,用iphone拍的。它不能是 47k ......应该是 ±500k