PHImageManager unable to allocate bytes for bitmap data

Hi,


Let's say - i have quite big image in Photo Library on my iPad (21600x21600 pixels, jpeg) and i'm trying to retrieve it with PHImageManager.requestImage(). If i'm passing targetSize with some smaller value (for example 1000x1000) - image retrieved properly. Othervise i'm getting following error (on iOS 9, on iOS 11 app crashes due to memory):

CGBitmapContextInfoCreate: unable to allocate 1866240000 bytes for bitmap data


My use case is to retrieve image from Photos, change it's size and jpeg quality as defined by user in settings and send it to server. Is there any way to make this work for really big images?

Replies

I am facing the same issue with iPad and mobile both. I'm trying to capture the frames and create a video