Take the 2-minute tour ×

I used CGImageGetDataProvider and CGDataProviderCopyData and then get a pointer to the data. The first image I tested was a bmp and this method worked great. However, I changed my image to a JPG because I had read something about the Data Provider possibly being relative to the type of image. The length of that data returned indicates that it is 4 when it should be some large number representing the rows and columns of the image.

What I need is I can ask for the Data Provider to be for a bitmap so I can walk through the data uncompressed?

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

The data you get out of the data provider will be the data that went into creating the image. For instance, if the image was created using CGImageCreateWithJPEGDataProvider, it would be JPEG data. If you want bitmap data, you will need to make a bitmap, perhaps using CGBitmapContextCreate, and draw the image into the bitmap.

share|improve this answer
CGBitmapContextCreeate have so many step. is there any direct method to convert JPEG data in to bitmap.It would be great if I can get the difference between Bitmap and JPEG data. –  pawan mangal Nov 8 '11 at 7:54
No, I don't think there is any easier way. –  JWWalker Nov 8 '11 at 17:12
add comment

Your Answer


