Hi Every one I am facing issue regarding to implement Dark and Highlight effect using Core Image builtin filters. I have worked with other filters but this one giving me wrong result or may be I am not using right filter. I am using CIFilter.highlightShadowAdjust filter Here is my implementation.
let context = CIContext(options: nil)
let filter = CIFilter.highlightShadowAdjust()
let aCIImage = CIImage(image: self.image)
filter.setValue(aCIImage, forKey: kCIInputImageKey)
filter.setValue(highlitValue, forKey: "inputHighlightAmount")
filter.setValue(shadowValue, forKey: "inputShadowAmount")
filter.setValue(radiousValue, forKey: "inputRadius")
guard let outputImage = filter.outputImage else {return UIImage()}
guard let cgimg = context.createCGImage(outputImage, from: outputImage.extent) else {return UIImage()}
return UIImage(cgImage: cgimg)
For clarification I also uploaded a Video what I want to achieve.
Any Suggestion or guid will be greatly thankful.