I am currently making an iphone application where a user takes a photo or selects it from an album, and then an inscription is placed on top of the image. Then the user can scale, rotate and save the image. Currently, I can take pictures or choose one for the album. As for the overlay, I just used UIImageView and placed it on top of the hierarchy in the interface builder. For the camera, I use this code:
-(IBAction)getPhoto:(id)sender { // Create an image picker controller UIImagePickerController * imagePicker = [[UIImagePickerController alloc] init]; if((UIButton *) sender == choosePhotoBtn) { // Set source to photo albums imagePicker.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum; } else { // Set source to camera imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera; imagePicker.showsCameraControls = YES; } // Delegate is self imagePicker.delegate = self; // Allow editing of image imagePicker.allowsEditing = YES; // Show image picker [self presentModalViewController:imagePicker animated: YES]; } -(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info { // Dismiss modalviewcontroller [picker dismissModalViewControllerAnimated:YES]; // Displaying image to the imageView imageView.image = [info objectForKey:@"UIImagePickerControllerOriginalImage"]; // Access the uncropped image from info dictionary UIImage * image = [info objectForKey:@"UIImagePickerControllerOriginalImage"]; // Save Image UIImageWriteToSavedPhotosAlbum(image, nil, nil, nil); [picker release]; }
The problem that I am currently facing is editing the photo after taking it. How to configure the camera in this way:
Choose either use the camera or get a photo from an album
After selecting the overlay image will change to one where I put a βcircleβ in the face, and the photo will be masked. This view will also be able to edit in full screen. You can rotate, scale and move the image until you click on it.
I read this part in the manual, but I cannot figure out how to use it. http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIImagePickerController_Class/UIImagePickerController/UIImagePickerController.html
Hope someone can point me in the right direction.
Many thanks. -Hakimo
source share