<!--
{
  "availability" : [
    "iOS: 7.0.0 -",
    "iPadOS: 7.0.0 -",
    "macCatalyst: 14.0.0 -",
    "macOS: 10.15.0 -",
    "tvOS: 17.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AVFoundation",
  "identifier" : "/documentation/AVFoundation/AVCaptureVideoPreviewLayer/metadataOutputRectConverted(fromLayerRect:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AVFoundation"
    ],
    "preciseIdentifier" : "c:objc(cs)AVCaptureVideoPreviewLayer(im)metadataOutputRectOfInterestForRect:"
  },
  "title" : "metadataOutputRectConverted(fromLayerRect:)"
}
-->

# metadataOutputRectConverted(fromLayerRect:)

Converts a rectangle from layer coordinates to the coordinate space of the metadata output.

```
func metadataOutputRectConverted(fromLayerRect rectInLayerCoordinates: CGRect) -> CGRect
```

## Parameters

`rectInLayerCoordinates`

A rectangle in the [`AVCaptureVideoPreviewLayer`](/documentation/AVFoundation/AVCaptureVideoPreviewLayer) object’s coordinate system.

## Return Value

A rectangle in the metadata output’s coordinate system.

## Discussion

A metadata capture output’s [`rectOfInterest`](/documentation/AVFoundation/AVCaptureMetadataOutput/rectOfInterest) a <doc://com.apple.documentation/documentation/CoreFoundation/CGRect> value where `{0,0}` represents the top-left of the picture area, and `{1,1}` represents the bottom-right on an unrotated image.

The system takes the layer’s frame size and its [`videoGravity`](/documentation/AVFoundation/AVCaptureVideoPreviewLayer/videoGravity) into consideration when making the conversion.

---

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)