Reputation: 1427
The specific structure of array is: first number= count of bytes, second number= width, third number= height, after these are 3 numbers for RBG for all of pixels.
Can I use a class or a method in iPhone SDK to convert these bytes to UIImage? Or do I have to write a function, which draw a picture from the byte array?
Upvotes: 0
Views: 308
Reputation: 22958
Look at CGImageCreate() which should allow you to create an image from data in a structured format. You can then create a UIImage
from the resulting CGImage
.
Upvotes: 1
Reputation: 2344
How are you getting that array, from some webService or you are creating in the coding side?
You can create an object of NSData Class
NSData * imageData = [[NSData allc] initWith..];
see different methods available for the class.
Use this data object to create your image.
UIImage * image = [[UIImage alloc]initWithData:imageData];
Upvotes: 0