views:

165

answers:

2

i want to write a app in which i open the camera.take a picture and then edit the picture..means put some cool effects on it...something like image editing...does some one knows a good or i say best approach to achieve this?

i want to know that is open-gl necessary to create an aap like image editing? i have iPhone with OS 2.0. i also have 3.0 sdk.i have jail broken iphone.

+2  A: 

Take a look at the UIImagePickerController class. It's a view controller that you can present modally, and it lets you "pick" an image from the camera using the iPhone's native interface for taking photos.

Tim
+2  A: 

This is truly easy. Your code will be in a subclass of UIViewController, let this class conform to the UIImagePickerControllerDelegate protocol, this allows your controller to receive images from the camera and/or users library.

Now you have to create and display a UIImagePickerController, this view controller can be used for both selecting images from the users library, and taking images/video with the camera. Implement something like this:

-(IBAction)takePictureWithCamera {
  UIImagePickerController* controller = [[UIImagePickerController alloc] init];
  controller.delegate = self;
  [self presentModalViewController:controller animated:YES];
  [controller release];
}

This will display the image picker, see documentation for UIImagePickerController for how to customize further if needed.

Next you need to receive the image the user picks, or takes with the camera. This is done by implementing the method imagePickerController:didFinishPickingMediaWithInfo: from the UIImagePickerControllerDelegate protocol.

-(void)imagePickerController:(UIImagePickerController*)picker
    didFinishPickingMediaWithInfo:(NSDictionary*)info {
  UIImage* image = [info objectForKey: UIImagePickerControllerOriginalImage];
  // Do stuff to image.
}

And that is it.

PeyloW