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

# MPSImageThresholdBinary

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

```
class MPSImageThresholdBinary
```

## Overview

An [`MPSImageThresholdBinary`](/documentation/MetalPerformanceShaders/MPSImageThresholdBinary) 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 binary function.

Listing 1. Threshold binary function

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

## Topics

### Initializers

[`init(coder:device:)`](/documentation/MetalPerformanceShaders/MPSImageThresholdBinary/init(coder:device:))

### Methods

[`init(device:thresholdValue:maximumValue:linearGrayColorTransform:)`](/documentation/MetalPerformanceShaders/MPSImageThresholdBinary/init(device:thresholdValue:maximumValue:linearGrayColorTransform:))

Initializes the kernel.

### Properties

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

The threshold value used to initialize the threshold filter.

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

The maximum value used to initialize the threshold filter.

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

The color transform used to initialize the threshold filter.



---

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)