<!--
{
  "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/MPSUnaryImageKernel",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "Metal Performance Shaders"
    ],
    "preciseIdentifier" : "c:objc(cs)MPSUnaryImageKernel"
  },
  "title" : "MPSUnaryImageKernel"
}
-->

# MPSUnaryImageKernel

A kernel that consumes one texture and produces one texture.

```
class MPSUnaryImageKernel
```

## Overview

[`MPSUnaryImageKernel`](/documentation/MetalPerformanceShaders/MPSUnaryImageKernel) defines shared behavior for most image processing kernels (filters) such as edging modes, clipping, and tiling support for image operations that consumes a single source textures. It is not meant to be used directly, but provides API abstraction and in some cases may allow some level of polymorphic manipulation of image kernel objects.

## Topics

### Initializers

[`-  initWithCoder:device:`](/documentation/MetalPerformanceShaders/MPSUnaryImageKernel/init(coder:device:))

[`-  initWithDevice:`](/documentation/MetalPerformanceShaders/MPSUnaryImageKernel/init(device:))

### Methods

[`-  encodeToCommandBuffer:inPlaceTexture:fallbackCopyAllocator:`](/documentation/MetalPerformanceShaders/MPSUnaryImageKernel/encode(commandBuffer:inPlaceTexture:fallbackCopyAllocator:))

This method attempts to apply a kernel in place on a texture.

[`MPSCopyAllocator`](/documentation/MetalPerformanceShaders/MPSCopyAllocator)

A block to make a copy of a source texture for filters that can only execute out of place.

[`-  encodeToCommandBuffer:sourceImage:destinationImage:`](/documentation/MetalPerformanceShaders/MPSUnaryImageKernel/encode(commandBuffer:sourceImage:destinationImage:))

[`-  encodeToCommandBuffer:sourceTexture:destinationTexture:`](/documentation/MetalPerformanceShaders/MPSUnaryImageKernel/encode(commandBuffer:sourceTexture:destinationTexture:))

Encodes a kernel into a command buffer, out of place.

[`-  sourceRegionForDestinationSize:`](/documentation/MetalPerformanceShaders/MPSUnaryImageKernel/sourceRegion(destinationSize:))

Determines the region of the source texture that will be read for an encode operation.

### Properties

[`offset`](/documentation/MetalPerformanceShaders/MPSUnaryImageKernel/offset)

The position of the destination clip rectangle origin relative to the source buffer.

[`MPSOffset`](/documentation/MetalPerformanceShaders/MPSOffset)

A signed coordinate with x, y, and z components.

[`clipRect`](/documentation/MetalPerformanceShaders/MPSUnaryImageKernel/clipRect)

An optional clip rectangle to use when writing data. Only the pixels in the rectangle will be overwritten.

[`MPSRegion`](/documentation/MetalPerformanceShaders/MPSRegion)

A region of an image.

[`edgeMode`](/documentation/MetalPerformanceShaders/MPSUnaryImageKernel/edgeMode)

The edge mode to use when texture reads stray off the edge of an image.

[`MPSImageEdgeMode`](/documentation/MetalPerformanceShaders/MPSImageEdgeMode)

The options used to control the edge behavior of an image filter when it reads outside the bounds of a source texture.

## Relationships

### Inherited By

[`MPSImageSobel`](/documentation/MetalPerformanceShaders/MPSImageSobel)

[`MPSImageThresholdBinary`](/documentation/MetalPerformanceShaders/MPSImageThresholdBinary)

[`MPSImageEuclideanDistanceTransform`](/documentation/MetalPerformanceShaders/MPSImageEuclideanDistanceTransform)

[`MPSImageLaplacian`](/documentation/MetalPerformanceShaders/MPSImageLaplacian)

[`MPSImageStatisticsMeanAndVariance`](/documentation/MetalPerformanceShaders/MPSImageStatisticsMeanAndVariance)

[`MPSImageAreaMax`](/documentation/MetalPerformanceShaders/MPSImageAreaMax)

[`MPSImageCanny`](/documentation/MetalPerformanceShaders/MPSImageCanny)

[`MPSImageDilate`](/documentation/MetalPerformanceShaders/MPSImageDilate)

[`MPSImageHistogramEqualization`](/documentation/MetalPerformanceShaders/MPSImageHistogramEqualization)

[`MPSImageMedian`](/documentation/MetalPerformanceShaders/MPSImageMedian)

[`MPSImagePyramid`](/documentation/MetalPerformanceShaders/MPSImagePyramid)

[`MPSImageThresholdTruncate`](/documentation/MetalPerformanceShaders/MPSImageThresholdTruncate)

[`MPSImageBox`](/documentation/MetalPerformanceShaders/MPSImageBox)

[`MPSImageGaussianBlur`](/documentation/MetalPerformanceShaders/MPSImageGaussianBlur)

[`MPSImageReduceUnary`](/documentation/MetalPerformanceShaders/MPSImageReduceUnary)

[`MPSImageIntegralOfSquares`](/documentation/MetalPerformanceShaders/MPSImageIntegralOfSquares)

[`MPSImageThresholdBinaryInverse`](/documentation/MetalPerformanceShaders/MPSImageThresholdBinaryInverse)

[`MPSImageTranspose`](/documentation/MetalPerformanceShaders/MPSImageTranspose)

[`MPSImageStatisticsMean`](/documentation/MetalPerformanceShaders/MPSImageStatisticsMean)

[`MPSImageHistogramSpecification`](/documentation/MetalPerformanceShaders/MPSImageHistogramSpecification)

[`MPSImageScale`](/documentation/MetalPerformanceShaders/MPSImageScale)

[`MPSImageIntegral`](/documentation/MetalPerformanceShaders/MPSImageIntegral)

[`MPSImageStatisticsMinAndMax`](/documentation/MetalPerformanceShaders/MPSImageStatisticsMinAndMax)

[`MPSImageConversion`](/documentation/MetalPerformanceShaders/MPSImageConversion)

[`MPSImageConvolution`](/documentation/MetalPerformanceShaders/MPSImageConvolution)

[`MPSImageThresholdToZeroInverse`](/documentation/MetalPerformanceShaders/MPSImageThresholdToZeroInverse)

[`MPSImageThresholdToZero`](/documentation/MetalPerformanceShaders/MPSImageThresholdToZero)

### Conforms To

[`Hashable`](/documentation/Swift/Hashable)

[`NSCoding`](/documentation/Foundation/NSCoding)

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

[`NSCopying`](/documentation/Foundation/NSCopying)

[`NSSecureCoding`](/documentation/Foundation/NSSecureCoding)

[`CVarArg`](/documentation/Swift/CVarArg)

[`Equatable`](/documentation/Swift/Equatable)

### Inherits From

[`MPSKernel`](/documentation/MetalPerformanceShaders/MPSKernel)

---

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)