How create UIImage from bytes ?

Posted by Sergey on Stack Overflow See other posts from Stack Overflow or by Sergey
Published on 2010-04-11T16:00:34Z Indexed on 2010/04/11 16:03 UTC
Read the original article Hit count: 573

Filed under:
|
|
|
|

Hello, all!

I need in UIImage created from my colors (for example, i need in image 1x1 pixel with black color).

I've got array:

unsigned char *color[] = {0, 0, 0, 1};

How can i create UIImage from this array ?

I've try

 unsigned char *bytes[4] = {0,0,0,1};
 NSData *data = [NSData dataWithBytes:bytes length:4];
 UIImage *img = [UIImage imageWithData:data];

but this method has no result...

© Stack Overflow or respective owner

Related posts about uiimage

Related posts about cgimage