Returns a new image created by making the pixel colors along its edges extend infinitely in all directions.
- iOS 8.0+
- macOS 10.10+
- Mac Catalyst 13.0+Beta
- tvOS 9.0+
- Core Image
An image object representing the result of the clamp operation.
Calling this method is equivalent to using the CIAffineClamp filter, which creates an image of infinite extent by repeating pixel colors from the edges of the original image.
This operation can be useful when using the image as input to other filters. When an image has finite extent, Core Image treats the area outside the extent as if it were filled with empty (black, zero alpha) pixels. If you apply a filter that samples from outside the image’s extent, those empty pixels affect the result of the filter.
For example, applying the
CIGaussian filter to an image softens the edges of the blurred image, because the opaque pixels at the edges of the image blur into the transparent pixels outside the image’s extent. Applying a clamp effect before the blur filter avoids edge softening by making the original image opaque in all directions. (However, the blurred image will also have infinite extent. Use the
image method to return to the original image’s dimensions while retaining hard edges.)