使用BJImageCropper在ios中的图像裁剪

时间:2023-01-18 21:21:11

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.

我在iOS中使用BJImageCropper进行图像裁剪,但是当我触摸图像的最后一个角时,它会自动更新另一边的高度和宽度。

使用BJImageCropper在ios中的图像裁剪

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

示例代码是https://github.com/barrettj/BJImageCropper/zipball/master

3 个解决方案

#1


2  

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

完成我刚才提出的任务。应该是固定的。

#2


0  

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

这是代码中的一个错误。联系作者纠正错误:

#3


0  

You can use another option for croping Image that is ContextRect

您可以使用另一个选项来编辑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.

您可以根据您的图像编辑视图的x、y原点和宽度n高度。

#1


2  

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

完成我刚才提出的任务。应该是固定的。

#2


0  

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

这是代码中的一个错误。联系作者纠正错误:

#3


0  

You can use another option for croping Image that is ContextRect

您可以使用另一个选项来编辑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.

您可以根据您的图像编辑视图的x、y原点和宽度n高度。