0

I have an app that show an image and the user can "cut" some part of the image.

My problem is that I can´t save the part cutted.

References:

How to save the UIImage after multi point cropping the image?

This is the method to crop the image:

    - (void) setClippingPath:(UIBezierPath *)clippingPath imagen:(UIImageView *)imagenView;
{
    if (![[imagenView layer] mask])
        [[imagenView layer] setMask:[CAShapeLayer layer]];


    [(CAShapeLayer*) [[imagenView layer] mask] setPath:[clippingPath CGPath]];
}

Can I save the new image?

Thanks

Community
  • 1
  • 1
Kaisser
  • 93
  • 3
  • 8

1 Answers1

0

On the comment:

- (UIImage *)imageFromView:(UIView *)view {
    CALayer *layer = view.layer;
    UIGraphicsBeginImageContext([layer frame].size);
    [layer renderInContext:UIGraphicsGetCurrentContext()];
    UIImage *outputImage = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    return outputImage;
}
Matic Oblak
  • 16,318
  • 3
  • 24
  • 43