views:

31

answers:

1

I open the camera view and place an image as an overlay. I then want to save both the overlay and the camera view's image as one image. Previously I achieved this using UIGetScreenImage(). Now that Apple forbid this what are my options ? takePicture will only capture the camera data but the the overlay. Merging the overlay with the image from takePicture is a bit slow.

A: 

You really will have to merge them, and it shouldn't take more than a second or two. Something like(untested, but should give an idea):

UIGraphicsBeginImageContext(myCapturedImage.size);
[myCapturedImage drawAtPoint:CGPointZero]; //You might need to use drawInRect
[overlayImage drawAtPoint:CGPointZero];
UIImage *combinedImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
Peter DeWeese
Thanks, yes this is the very close to the way I ended up doing it.
ADude
One thing I found is that it was didFinishSavingWithError that was taking ages to be called. I'm looking into this. It also appears to lock the UI until it's called. I would have thought the image saving would have been done on a separate thread?
ADude
You can run it on a separate thread using [NSThread performBlockInBackground:^{}. Make sure that nothing used by the block is released until the block completes!
Peter DeWeese