---
title: morphologyRectangleMaximum()
framework: coreimage
role: symbol
role_heading: Type Method
path: coreimage/cifilter-swift.class/morphologyrectanglemaximum()
---

# morphologyRectangleMaximum()

Blurs a rectangular area by enlarging contrasting pixels.

## Declaration

```swift
class func morphologyRectangleMaximum() -> any CIFilter & CIMorphologyRectangleMaximum
```

## Return Value

Return Value The blurred image.

## Discussion

Discussion This method applies the morphology rectangle maximum filter to an image. The effect targets a rectangular section of the image, calculating the median color values to find colors that make up more than half the working area. Using this calculation, the effect enlarges the pixels with contrasting colors to take up more of the working area. The effect is then repeated throughout the image. The morphology rectangle maximum filter uses the following properties: The following code creates a filter that adds a blur to the input image while brighting the palm trees:     func morphologyRectangleMaximum(inputImage: CIImage) -> CIImage? {

let morphologyRectangleMaximumFilter = CIFilter.morphologyRectangleMaximum()         morphologyRectangleMaximumFilter.inputImage = inputImage         morphologyRectangleMaximumFilter.width = 5         morphologyRectangleMaximumFilter.height = 5         return morphologyRectangleMaximumFilter.outputImage     }

## See Also

### Filters

- [bokehBlur()](coreimage/cifilter-swift.class/bokehblur().md)
- [boxBlur()](coreimage/cifilter-swift.class/boxblur().md)
- [discBlur()](coreimage/cifilter-swift.class/discblur().md)
- [gaussianBlur()](coreimage/cifilter-swift.class/gaussianblur().md)
- [maskedVariableBlur()](coreimage/cifilter-swift.class/maskedvariableblur().md)
- [median()](coreimage/cifilter-swift.class/median().md)
- [morphologyGradient()](coreimage/cifilter-swift.class/morphologygradient().md)
- [morphologyMaximum()](coreimage/cifilter-swift.class/morphologymaximum().md)
- [morphologyMinimum()](coreimage/cifilter-swift.class/morphologyminimum().md)
- [morphologyRectangleMinimum()](coreimage/cifilter-swift.class/morphologyrectangleminimum().md)
- [motionBlur()](coreimage/cifilter-swift.class/motionblur().md)
- [noiseReduction()](coreimage/cifilter-swift.class/noisereduction().md)
- [zoomBlur()](coreimage/cifilter-swift.class/zoomblur().md)
