---
title: "clamped(to:)"
framework: coreimage
role: symbol
role_heading: Instance Method
path: "coreimage/ciimage/clamped(to:)"
---

# clamped(to:)

Returns a new image created by cropping to a specified area, then making the pixel colors along the edges of the cropped image extend infinitely in all directions.

## Declaration

```swift
func clamped(to rect: CGRect) -> CIImage
```

## Parameters

- `rect`: The rectangle, in image coordinates, to which to crop the image.

## Return Value

Return Value An image object representing the result of the clamp operation.

## Discussion

Discussion Calling this method is equivalent to cropping the image (with the cropped(to:) method or the CICrop filter), then using the clampedToExtent() method (or the CIAffineClamp filter), which creates an image of infinite extent by repeating pixel colors from the edges of the cropped image.

## See Also

### Creating an Image by Modifying an Existing Image

- [applyingFilter(_:parameters:)](coreimage/ciimage/applyingfilter(_:parameters:).md)
- [applyingFilter(_:)](coreimage/ciimage/applyingfilter(_:).md)
- [transformed(by:)](coreimage/ciimage/transformed(by:).md)
- [transformed(by:highQualityDownsample:)](coreimage/ciimage/transformed(by:highqualitydownsample:).md)
- [cropped(to:)](coreimage/ciimage/cropped(to:).md)
- [oriented(forExifOrientation:)](coreimage/ciimage/oriented(forexiforientation:).md)
- [clampedToExtent()](coreimage/ciimage/clampedtoextent().md)
- [composited(over:)](coreimage/ciimage/composited(over:).md)
- [convertingWorkingSpaceToLab()](coreimage/ciimage/convertingworkingspacetolab().md)
- [convertingLabToWorkingSpace()](coreimage/ciimage/convertinglabtoworkingspace().md)
- [matchedToWorkingSpace(from:)](coreimage/ciimage/matchedtoworkingspace(from:).md)
- [matchedFromWorkingSpace(to:)](coreimage/ciimage/matchedfromworkingspace(to:).md)
- [premultiplyingAlpha()](coreimage/ciimage/premultiplyingalpha().md)
- [unpremultiplyingAlpha()](coreimage/ciimage/unpremultiplyingalpha().md)
- [settingAlphaOne(in:)](coreimage/ciimage/settingalphaone(in:).md)
