In objective c,
I need to convert a UIImage into something that matches the following type:
const unsigned char myImg[6300] = { 0xff,0xff,0xff,0xff,0xff,0xff,0x0,0x0,0x0,
0x0,0xff,0xff,0x0,0x0,0xff,0xff,0xff,0xff,0x0,0x0,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0x0,0x0,0xff,0xff, etc etc etc }
I've read the NSData docs, and tried:
self.animalImage = [UIImage imageNamed:@"animal.png"];
self.animalData = UIImagePNGRepresentation(self.animalImage);
NSUInteger size = [self.animalData length] / sizeof(unsigned char);
unsigned char* array = (unsigned char*) [self.animalData bytes];
But the result is garbage or nil, I need it to match the above format exactly. Any thoughts? Thanks in advance for any tips!