Need help using UIImagePNGRepresentation

Posted by mustanggal511 on Stack Overflow See other posts from Stack Overflow or by mustanggal511
Published on 2010-03-19T03:55:44Z Indexed on 2010/03/19 4:01 UTC
Read the original article Hit count: 271

Filed under:

I'm trying to save a UIImageView image to a png file, and then use that file as a GLTexture. I'm having trouble with this, when I try to run my code in the simulator, XCode says it succeeded, but the simulator crashes with no error messages. Can someone help me with this? Here is my code:

NSString *dataFilePath = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents/Picture.png"];

NSData *imageData = UIImagePNGRepresentation(imageView.image); [imageData writeToFile:dataFilePath atomically:YES];

// Load image into texture loadTexture("Picture.png", &Input, &renderer);

© Stack Overflow or respective owner

Related posts about iphone