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

# blendWithBlueMask()

Blends two images by using a blue mask image.

```
class func blendWithBlueMask() -> any CIFilter & CIBlendWithMask
```

## Return Value

The modified image.

## Discussion

This method applies the blend with blue mask filter to an image. The effect uses values from the blue mask image to interpolate between the input and background images. The mask image is made of shades of blue that define the strength of the interpolation from zero (where the mask image is black) to the specified `radius` (where the mask image is blue).

The blend with blue mask filter uses the following properties:

- `inputImage`: An image with the type [`CIImage`](/documentation/CoreImage/CIImage).
- `maskImage`: An image that masks an area on the background image with the type [`CIImage`](/documentation/CoreImage/CIImage).
- `backgroundImage`: An image with the type [`CIImage`](/documentation/CoreImage/CIImage).

The following code creates a filter that results in the replacement of blue in the mask image with the detail of the input image:

```swift
func blendWithBlueMask(inputimage: CIImage, backgroundimage: CIImage, maskimage: CIImage) -> CIImage {
    let  blendWithBlueMaskFilter = CIFilter.blendWithBlueMask()
    blendWithBlueMaskFilter.inputImage = inputimage
    blendWithBlueMaskFilter.maskImage = maskimage
    blendWithBlueMaskFilter.backgroundImage = backgroundimage
    return blendWithBlueMaskFilter.outputImage!
}
```

![A set of four photographs with two stacked on the left and two side by side on the right. The top photo on the left is of the New York City skyline taken from across the river on an overcast day, with a single boat in the center of the image. The bottom photo on the left is of multiple colorful rocks with green moss covering them. The first photograph on the right is a transparent image with a five-point triangle, hexagon, circle and square filled with a gradient of dark blue to green. The second photograph on the right is a blend with a blue mask filter applied, resulting in the skyline photo with the detail of the moss-covered rocks showing in the area that is dark blue from the mask image.](images/com.apple.coreimage/media-3624592@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)