0

how to reduce the quality of PHAsset images and retrieve back the original size of the image, since it takes a lot of memory?

PHImageManager *manager = [PHImageManager defaultManager];

__block UIImage *ima;
for (PHAsset *asset in phAssets) {
    // Do something with the asset

    [manager requestImageForAsset:asset
                       targetSize:CGSizeMake(250, 250)
                      contentMode:PHImageContentModeAspectFill
                          options:requestOptions
                    resultHandler:^void(UIImage *image, NSDictionary *info) {
                        ima = image;

                        [images addObject:ima];

                    }];
}
Glenn Posadas
  • 12,555
  • 6
  • 54
  • 95
jeremy gv
  • 77
  • 1
  • 10
  • post your code how you accessing photos. – Ketan Parmar Apr 20 '16 at 07:45
  • the above code i used for compressing image ...is there any way to retrieve original size of an image back when selecting a particular image in an array – jeremy gv Apr 20 '16 at 07:53
  • Are you receiving memory warning ? – Ketan Parmar Apr 20 '16 at 07:56
  • 1
    Any reason why you want a low quality image and then retrieving its original size? And yea, are you receiving a memory warning? I think you should not. – Glenn Posadas Apr 20 '16 at 08:58
  • memory of the app is exceeding to 400mb while fetching all the photos,inorder to rectify it i need to lower the quality of the image – jeremy gv Apr 20 '16 at 09:03
  • Check this link: http://stackoverflow.com/questions/5887248/ios-app-maximum-memory-budget/15200855#15200855 --- You can see the ios app maximum memory budget. I remember one time I was dealing with the crash in my project that uses Core Filters and of course PHAssets, I always make sure that I dispatch to the main thread the codes inside that result handler when requesting for assets, doing this resolved the crash. Try it. Also, may I see your requestOptions? – Glenn Posadas Apr 20 '16 at 10:17

0 Answers0