简体   繁体   中英

image crop in ios using BJImageCropper

I am using BJImageCropper for image crop in iOS, but when I am touching on the image's last corner, it's automatically updating the height and width on the opposite side.

Example code is https://github.com/barrettj/BJImageCropper/zipball/master

Get the commit I just pushed. Should be fixed there.

That is a bug in the code. Contact the author to correct the errors :)

You can use another option for croping Image that is ContextRect

A short Example of it is :

CGRect contextRect = CGRectMake(50, 50, 200, 200);

UIGraphicsBeginImageContext(contextRect.size);

[self.view.layer renderInContext : UIGraphicsGetCurrentContext()];

UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();

UIGraphicsEndImageContext();

CGImageRef imageRef = CGImageCreateWithImageInRect([viewImage CGImage], contextRect);

UIImage * savedImage = [UIImage imageWithCGImage:imageRef scale:1.0 orientation:viewImage.imageOrientation];

You can edit the x,y origin and width n height of the view according to your image.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM