<!--
{
  "availability" : [
    "iOS: 6.0.0 -",
    "iPadOS: 6.0.0 -",
    "macCatalyst: 13.1.0 -",
    "tvOS: -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UIImage/withAlignmentRectInsets(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(cs)UIImage(im)imageWithAlignmentRectInsets:"
  },
  "title" : "withAlignmentRectInsets(_:)"
}
-->

# withAlignmentRectInsets(_:)

Returns a new version of the image that uses the specified alignment insets.

```
func withAlignmentRectInsets(_ alignmentInsets: UIEdgeInsets) -> UIImage
```

## Parameters

`alignmentInsets`

The alignment metadata to apply to the new image.

## Return Value

A new image object.

## See Also

[`alignmentRectInsets`](/documentation/UIKit/UIImage/alignmentRectInsets)

The alignment metadata for positioning the image during layout.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)