Closed waqasrasheed86 closed 1 year ago
I think it is a more general way to generate a square image. The circular effect can be implemented through the cornerRadius
of UIImageView
.
Maybe you can use this code to generate a circular image from a square image:
let image = UIImage()
let cornerRadius: CGFloat = image.size.width / 2
UIGraphicsBeginImageContextWithOptions(image.size, false, image.scale)
let rect = CGRect(origin: .zero, size: image.size)
UIBezierPath(roundedRect: rect, cornerRadius: cornerRadius).addClip()
image.draw(in: rect)
let result = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
Circular Cropper is not cropped the circular shape. it return only the square cropped image