ios Decode part of an image

Viewed 1807

I have a big image which is too big to be loaded into memory but i am only interested in a sub set of pixels within that big image. Is it possible to decode into memory only this subset of pixels? I know that in Android there is a class in the API to do exactly this called BitmapRegionDecoder are something like that

I found CGDataProviderCreateSequential but it needs the raw pixels in the constructor...

Right now i am doing something like this :

UIImage* srcImage = ...;
    CFDataRef cgImgDataRef = CGDataProviderCopyData(CGImageGetDataProvider(srcImage.CGImage));//After this call, all pixels are decoded into memory and the app crashes
char* imageData = (char*)CFDataGetBytePtr(cgImgDataRef);
1 Answers
Related