<!--
{
  "availability" : [
    "macOS: 10.7.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSImage/recommendedLayerContentsScale(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSImage(im)recommendedLayerContentsScale:"
  },
  "title" : "recommendedLayerContentsScale(_:)"
}
-->

# recommendedLayerContentsScale(_:)

Returns the recommended layer contents scale for this image.

```
func recommendedLayerContentsScale(_ preferredContentsScale: CGFloat) -> CGFloat
```

## Parameters

`preferredContentsScale`

The preferred layer contents scale. Don’t use a higher scale factor if the image can’t provide it. If the image is resolution independent the return value will be the same as the input. If you specify `0.0` for this parameter, the method uses the scale factor for the default screen.

## Return Value

The recommended layer contents scale. This scale factor may be different than the one in the `preferredContentsScale` parameter.

## Discussion

Use this method to obtain the scale factor value that you pass to the [`layerContents(forContentsScale:)`](/documentation/AppKit/NSImage/layerContents(forContentsScale:)) method. This method uses the image data to determine the scale factor that is best suited for creating an image that looks good in the layer.

---

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)