我想從UIImagePickerControllerSourceTypePhotoLibrary
獲得圖像,在從圖像庫中選擇圖像之前,我想知道該特定圖像的內存大小。我正在使用如何在UIImage拾取器控制器選擇它之前獲取圖像的大小?
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
UIImage * img = [info objectForKey:@"UIImagePickerControllerEditedImage"];
size_t imageSize = CGImageGetBytesPerRow(img.CGImage) * CGImageGetHeight(img.CGImage);
printf("\n the image size is :%zd",imageSize);
[self useImage:img];
[[picker parentViewController] dismissModalViewControllerAnimated:NO];
UINavigationController* navController = self.navigationController;
UIViewController* controller = [navController.viewControllers objectAtIndex:0];
[controller dismissModalViewControllerAnimated:NO];
}
這裏我正在計算的圖像大小不正確,圖像庫中的圖像大小究竟與我正在計算的圖像大小有什麼不同。 我想採摘圖像 誰能幫我 在此先感謝前需要了解的圖像尺寸
你試過我的答案? –