---
title: MPSImageThresholdTruncate
framework: metalperformanceshaders
role: symbol
role_heading: Class
path: metalperformanceshaders/mpsimagethresholdtruncate
---

# MPSImageThresholdTruncate

A filter that clamps the return value to an upper specified value.

## Declaration

```swift
class MPSImageThresholdTruncate
```

## Overview

Overview An MPSImageThresholdTruncate 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 truncate function. Listing 1. Threshold truncate function destinationPixelValue = sourcePixelValue > thresholdValue ? thresholdValue : sourcePixelValue

## Topics

### Initializers

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

### Methods

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

### Properties

- [thresholdValue](metalperformanceshaders/mpsimagethresholdtruncate/thresholdvalue.md)
- [transform](metalperformanceshaders/mpsimagethresholdtruncate/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

- [MPSImageThresholdBinary](metalperformanceshaders/mpsimagethresholdbinary.md)
- [MPSImageThresholdBinaryInverse](metalperformanceshaders/mpsimagethresholdbinaryinverse.md)
- [MPSImageThresholdToZero](metalperformanceshaders/mpsimagethresholdtozero.md)
- [MPSImageThresholdToZeroInverse](metalperformanceshaders/mpsimagethresholdtozeroinverse.md)
