Tocropviewcontroller: Saving the image with circular crop

Created on 28 Jan 2021  ·  4Comments  ·  Source: TimOliver/TOCropViewController

Hi, i'm saving the circula crop image in a server, but I want to know, how can I save the image without the circular shape?
It's possible to remove the circular shape?

question

Most helpful comment

@Snow-Tech
The image is cropped and masked before being rasterised. Checkout the implementation below to make them square going forward.

@nightbird8n
I was able to achieve this by using the nice, bundled extensions with their delegate methods.

 func cropViewController(_ cropViewController: TOCropViewController, didCropImageTo cropRect: CGRect, angle: Int) {
    let squareImg = self.image.croppedImage(withFrame: cropRect, angle: angle, circularClip: false)
  }

All 4 comments

Hi @TimOliver ,
Can I get square image(not circular cropped image) when crop circle(I want to use circle mask to crop, but I want a square cropped image)? Is this possible?

@Snow-Tech
The image is cropped and masked before being rasterised. Checkout the implementation below to make them square going forward.

@nightbird8n
I was able to achieve this by using the nice, bundled extensions with their delegate methods.

 func cropViewController(_ cropViewController: TOCropViewController, didCropImageTo cropRect: CGRect, angle: Int) {
    let squareImg = self.image.croppedImage(withFrame: cropRect, angle: angle, circularClip: false)
  }

Brilliant answer! Thank you, @luke-riu

Thank u, @luke-riu.

Was this page helpful?
0 / 5 - 0 ratings