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

# MPSImageThresholdToZeroInverse

A filter that returns 0 for each pixel with a value greater than a specified threshold or the original value otherwise.

```
class MPSImageThresholdToZeroInverse
```

## Overview

An [`MPSImageThresholdToZeroInverse`](/documentation/MetalPerformanceShaders/MPSImageThresholdToZeroInverse) filter converts a single channel image to a binary image. If the input image is not a single channel image, the function first converts the input image into a single channel luminance image using the linear gray color transform, and then it applies the threshold.

The following listing shows the threshold to zero inverse function.

Listing 1. Threshold to zero inverse function

```other
destinationPixelValue = sourcePixelValue > thresholdValue ? 0 : sourcePixelValue
```

## Topics

### Initializers

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

### New Methods

[`-  initWithDevice:thresholdValue:linearGrayColorTransform:`](/documentation/MetalPerformanceShaders/MPSImageThresholdToZeroInverse/init(device:thresholdValue:linearGrayColorTransform:))

Initializes the kernel.

### Properties

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

The threshold value used to initialize the threshold filter.

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

The color transform used to initialize the threshold filter.

## Relationships

### Conforms To

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

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

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

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

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

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

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

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

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

### Inherits From

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

---

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)