---
title: MPSImageBox
framework: metalperformanceshaders
role: symbol
role_heading: Class
path: metalperformanceshaders/mpsimagebox
---

# MPSImageBox

A filter that convolves an image with a given kernel of odd width and height.

## Declaration

```swift
class MPSImageBox
```

## Overview

Overview The kernel elements all have equal weight, achieving a blur effect (each result is the unweighted average of the surrounding pixels). This allows for much faster algorithms, especially for larger blur radii. The box height and width must be odd numbers. The box blur is a separable filter and the Metal Performance Shaders framework will act accordingly to give best performance for multi-dimensional blurs.

## Topics

### Initializers

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

### Methods

- [init(device:kernelWidth:kernelHeight:)](metalperformanceshaders/mpsimagebox/init(device:kernelwidth:kernelheight:).md)

### Properties

- [kernelHeight](metalperformanceshaders/mpsimagebox/kernelheight.md)
- [kernelWidth](metalperformanceshaders/mpsimagebox/kernelwidth.md)

## Relationships

### Inherits From

- [MPSUnaryImageKernel](metalperformanceshaders/mpsunaryimagekernel.md)

### Inherited By

- [MPSImageTent](metalperformanceshaders/mpsimagetent.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

### Convolution Image Filters

- [MPSImageConvolution](metalperformanceshaders/mpsimageconvolution.md)
- [MPSImageMedian](metalperformanceshaders/mpsimagemedian.md)
- [MPSImageTent](metalperformanceshaders/mpsimagetent.md)
- [MPSImageGaussianBlur](metalperformanceshaders/mpsimagegaussianblur.md)
- [MPSImageGaussianPyramid](metalperformanceshaders/mpsimagegaussianpyramid.md)
- [MPSImageSobel](metalperformanceshaders/mpsimagesobel.md)
- [MPSImageLaplacian](metalperformanceshaders/mpsimagelaplacian.md)
- [MPSImageLaplacianPyramid](metalperformanceshaders/mpsimagelaplacianpyramid.md)
- [MPSImageLaplacianPyramidAdd](metalperformanceshaders/mpsimagelaplacianpyramidadd.md)
- [MPSImageLaplacianPyramidSubtract](metalperformanceshaders/mpsimagelaplacianpyramidsubtract.md)
- [MPSImagePyramid](metalperformanceshaders/mpsimagepyramid.md)
