Problem with UIImagePickerControllerEditedImage

I need to change my images before importing into the application, but after editing the image, the quality decreases, how can this be avoided?

- (void) imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {

    [self dismissModalViewControllerAnimated:YES];
    imgEdited.image = [info objectForKey:UIImagePickerControllerEditedImage];


}
+5
source share
4 answers
- (void)imagePickerController:(UIImagePickerController *)picker 
                      didFinishPickingMediaWithInfo:(NSDictionary *)info {

  [picker dismissModalViewControllerAnimated:YES];
  [picker release];

          // Edited image works great (if you allowed editing)
  myUIImageView.image = [info objectForKey:UIImagePickerControllerEditedImage];
          // AND the original image works great
  myUIImageView.image = [info objectForKey:UIImagePickerControllerOriginalImage];
          // AND do whatever you want with it, (NSDictionary *)info is fine now
  UIImage *myImage = [info objectForKey:UIImagePickerControllerEditedImage];
}

You can edit ur image. Try this, it might work for your application. Thank!

+1
source

You can crop UIImagePickerControllerOriginalImagemanually using the value provided through UIImagePickerControllerCropRect.

An untethered quick and dirty example:

static UIImage *my_croppedImage(UIImage *image, CGRect cropRect)
{
    UIGraphicsBeginImageContext(cropRect.size);
    [image drawAtPoint:CGPointMake(-cropRect.origin.x, -cropRect.origin.y)];
    UIImage *cropped = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    return cropped;
}

- (void) imagePickerController:(UIImagePickerController *)picker
 didFinishPickingMediaWithInfo:(NSDictionary *)info
{
    // …

    UIImage *originalImage = info[UIImagePickerControllerOriginalImage];
    CGRect cropRect = [info[UIImagePickerControllerCropRect] CGRectValue];
    UIImage *croppedImage = my_croppedImage(originalImage, cropRect);

    // …
}    
+4
source

The decline in quality has nothing to do with the code you specified above. Image quality depends on what you do with your image during editing. Are you zooming in and out?

0
source

Ok That will sound stupid. But is the image really low or is it just displayed as low quality?

You can export this image to your computer and check for actually low quality, not just an image showing it as low quality.

0
source

All Articles