<!--
{
  "availability" : [
    "iOS: 15.0.0 -",
    "iPadOS: 15.0.0 -",
    "macCatalyst: 15.0.0 -",
    "macOS: 12.0.0 -",
    "tvOS: 15.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreImage",
  "identifier" : "/documentation/CoreImage/CIFilter-swift.class/convolutionRGB5X5()",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "Core Image",
      "CoreImage"
    ],
    "preciseIdentifier" : "c:objc(cs)CIFilter(cm)convolutionRGB5X5Filter"
  },
  "title" : "convolutionRGB5X5()"
}
-->

# convolutionRGB5X5()

Applies a convolution 5 x 5 filter to the `RGB` components of an image.

```
class func convolutionRGB5X5() -> any CIFilter & CIConvolution
```

## Return Value

This method applies a 5 x 5 convolution to the `RGB` components image. The effect uses a 5 x 5 area surrounding an input pixel, the pixel itself, and those within a distance of two pixels horizontally and vertically. The effect repeats this for every pixel within the image. The work area is then combined with the weight property vector to produce the processed image. This filter differs from the [`convolution5X5()`](/documentation/CoreImage/CIFilter-swift.class/convolution5X5()) filter, which processes all of the color components including the alpha component.

## Discussion

The convolution-RGB 5 x 5 filter uses the following properties:

- `inputImage`: A [`CIImage`](/documentation/CoreImage/CIImage) containing the image to process.
- `weights`: A [`CIVector`](/documentation/CoreImage/CIVector) representing the convolution kernel.
- `bias`: A `float` representing the value that’s added to each output pixel.

> Note:
> When using a nonzero `bias` value, the output image has an infinite extent. You should crop the output image before attempting to render it.

The following code creates a filter that applies an unsharp kernel to the input image:

```swift
func convolutionRGB5X5(inputImage: CIImage) -> CIImage {
    let convolutionFilter = CIFilter.convolutionRGB5X5()
    convolutionFilter.inputImage = inputImage
    let blur: [CGFloat] = [
         1, 1, 1, 1, 1,
         1, 1, 1, 1, 1,
         1, 1, 1, 1, 1,
         1, 1, 1, 1, 1,
         1, 1, 1, 1, 1,
    ].map { $0/25.0 }
    let kernel = CIVector(values: blur, count: 25)
    convolutionFilter.weights = kernel
    convolutionFilter.bias = 0
    return convolutionFilter.outputImage!
}
```

![Two images arranged horizontally. The left image contains a photo of the Golden Gate Bridge with a clear sky as the background. The right image shows the result of applying a 5 x 5 box blur convolution kernel. Fine detail in the image is now blurred.](images/com.apple.coreimage/media-4407325@2x.png)

---

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)