<!--
{
  "availability" : [
    "iOS: 9.0.0 -",
    "iPadOS: 9.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.13.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "MetalPerformanceShaders",
  "identifier" : "/documentation/MetalPerformanceShaders/MPSImageAreaMax/init(device:kernelWidth:kernelHeight:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Metal Performance Shaders"
    ],
    "preciseIdentifier" : "c:objc(cs)MPSImageAreaMax(im)initWithDevice:kernelWidth:kernelHeight:"
  },
  "title" : "init(device:kernelWidth:kernelHeight:)"
}
-->

# init(device:kernelWidth:kernelHeight:)

Initializes the kernel with a specified width and height.

```
init(device: any MTLDevice, kernelWidth: Int, kernelHeight: Int)
```

## Parameters

`device`

The Metal device the filter will run on.

`kernelWidth`

The width of the kernel. Must be an odd number.

`kernelHeight`

The height of the kernel. Must be an odd number.

## Return Value

Returns an initialized kernel object with a specific width and height.

---

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)