---
title: MPSImageThresholdBinary
framework: metalperformanceshaders
role: symbol
role_heading: Class
path: metalperformanceshaders/mpsimagethresholdbinary
---

# MPSImageThresholdBinary

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

## Declaration

```swift
class MPSImageThresholdBinary
```

## Overview

Overview An 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 destinationPixelValue = sourcePixelValue > thresholdValue ? maximumValue : 0

## Topics

### Initializers

- [init(coder:device:)](metalperformanceshaders/mpsimagethresholdbinary/init(coder:device:).md)

### Methods

- [init(device:thresholdValue:maximumValue:linearGrayColorTransform:)](metalperformanceshaders/mpsimagethresholdbinary/init(device:thresholdvalue:maximumvalue:lineargraycolortransform:).md)

### Properties

- [thresholdValue](metalperformanceshaders/mpsimagethresholdbinary/thresholdvalue.md)
- [maximumValue](metalperformanceshaders/mpsimagethresholdbinary/maximumvalue.md)
- [transform](metalperformanceshaders/mpsimagethresholdbinary/transform.md)

## Relationships

### Inherits From

- [MPSUnaryImageKernel](metalperformanceshaders/mpsunaryimagekernel.md)

### Conforms To

- [CVarArg](swift/cvararg.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [NSCoding](foundation/nscoding.md)
- [NSCopying](foundation/nscopying.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)
- [NSSecureCoding](foundation/nssecurecoding.md)

## See Also

### Image Threshold Filters

- [MPSImageThresholdBinaryInverse](metalperformanceshaders/mpsimagethresholdbinaryinverse.md)
- [MPSImageThresholdToZero](metalperformanceshaders/mpsimagethresholdtozero.md)
- [MPSImageThresholdToZeroInverse](metalperformanceshaders/mpsimagethresholdtozeroinverse.md)
- [MPSImageThresholdTruncate](metalperformanceshaders/mpsimagethresholdtruncate.md)
