Returns a new image with a cropped portion of the original image.
- iOS 5.0+
- macOS 10.5+
- Mac Catalyst 13.0+
- tvOS 9.0+
- Core Image
The rectangle, in image coordinates, to which to crop the image.
An image object cropped to the specified rectangle.
Due to Core Image's coordinate system mismatch with UIKit, this filtering approach may yield unexpected results when displayed in a
content. Be sure to back it with a
cg so that it handles
If you are displaying or processing your image primarily as a
UIImage, with no additional Core Image application, consider cropping in Core Graphics using the
cropping(to:) function to save processing overhead from conversion of images to
CIImage. It makes most sense to use
cropped(to:) when you already have
CIImage in your pipeline.