Length of data returned from CGImageGetDataProvider is larger than expected
- by jcoplan
I'm loading a grayscale png image and I want to access the underlying pixel data. However after I load get the pixel data via CGImageGetDataProvider, the length of the data returned is longer than expected.
CCGDataProviderRef provider = CGDataProviderCreateWithFilename(cStr);
CGImageRef image = CGImageCreateWithPNGDataProvider(provider, NULL, FALSE, kCGRenderingIntentDefault);
mapWidth = CGImageGetWidth(image);
mapHeight = CGImageGetHeight(image);
lookupMap = CGDataProviderCopyData(CGImageGetDataProvider(image));
mapWidth comes out to 1804 and
mapHeight comes out to 1005. The product of which is 1813020
When I call
CFDataGetLength(lookupMap)
the response is 1833120.
Where are these extra 20100 bytes coming from?
Any help here is much appreciated. Am I missing something about the underlying format of the image?