luminosityBlendMode()
Blends color from two images by calculating the color, hue, and saturation.
Declaration
class func luminosityBlendMode() -> any CIFilter & CICompositeOperationReturn Value
The modified image.
Discussion
This method applies the luminosity-blend mode filter to an image. The effect creates the output image by using the hue and saturation values of the background image while using the luminance values of the input image.
The luminosity-blend mode filter uses the following properties:
The following code creates a filter that results in the image having accurate gray colors while other colors are added from the background image:
func luminosityBlendMode(inputImage: CIImage, backgroundImage: CIImage) -> CIImage {
let colorBlendFilter = CIFilter.luminosityBlendMode()
colorBlendFilter.inputImage = inputImage
colorBlendFilter.backgroundImage = backgroundImage
return colorBlendFilter.outputImage!
}[Image]