I need to get only the selected image without background , we are trying to avoid the back ground and we need selected part should only cropped. and how to change the pixel data on tap selection of image color.
OR can we do like this:
Before crop:
After crop:
You can allow user to draw on image after selection using bezierpath, once you have path - You can use a shapeLayer for that. Something like:
CAShapeLayer *shapeLayer = [CAShapeLayer layer];
shapeLayer.path = aPath.CGPath;
[view.layer setMask:shapeLayer];//or make it as
[imageview.layer setMask:shapreLayer];
// and add imageView as subview of whichever view you want.
// draw the original image on the imageview in that case
To get it as an image,
UIGraphicsBeginImageContext(view.bounds.size);
[view.layerrenderInContext:UIGraphicsGetCurrentContext()];
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.