Contents

subtractBlendMode()

Blends colors by subtracting color values from two images.

Declaration

class func subtractBlendMode() -> any CIFilter & CICompositeOperation

Return Value

The modified image.

Discussion

This method applies the subtract-blend mode filter to an image. The effect calculates the colors in the output image by subtracting the color values that differ between the background image and the input image.

The subtract-blend mode filter uses the following properties:

inputImage

An image with the type CIImage.

backgroundImage

An image with the type CIImage.

The following code creates a filter that results in the image becoming darker with less detail:

func subtractBlendMode(inputImage: CIImage, backgroundImage: CIImage) -> CIImage {
    let colorBlendFilter = CIFilter.subtractBlendMode()
    colorBlendFilter.inputImage = inputImage
    colorBlendFilter.backgroundImage = backgroundImage
    return colorBlendFilter.outputImage!
}

[Image]

See Also

Filters