views:

58

answers:

2

I am making an app that adds a picture frame to a photo.

I would like to know how to have my Save button save both Images (the photo, and the frame) as one Image.

Right now it only saves one of the images.

In interface builder I have the save action saving the image that is loaded into an ImageView, with the frame ImageView overlaying that image.

I'd like to merge the two photos as one, so the save action can save the image with the frame.

Thanks!

A: 

This probably isn't what you want, but if you load both images into OpenGL (there's a nice Apple sample that loads images in OpenGL), lay one on top of the other, and then write the result to an image (excellent tutorial here - http://www.bit-101.com/blog/?p=1861).

You don't even need to render it to the screen, so there's no fiddling around with EAGL.

mtc06
+2  A: 

If you've displayed the frame over the photo in your UI, just use UIScreenGetImage something like

...
CGImageRef screen = UIGetScreenImage();
UIImage* image = [UIImage imageWithCGImage:screen];
CGImageRelease(screen);

// You could, e.g., save the captured image to photo album
UIImageWriteToSavedPhotosAlbum(image, self,  @selector(image:didFinishSavingWithError:contextInfo:), nil);
Art Gillespie
I'm kinda of new to the developing thing. So I'm not exactly sure what that code would do (I believe it would take a screen shot?) Nor do I know where to put that line of code. Could someone maybe elaborate, please? Sorry and Thanks again!
Put it in the method your save button is connected to.
Art Gillespie