JessJ
JessJ

Reputation: 57

How to control intensity of CIFilter without inputIntensity parameter in Swift4?

I'm trying to making a photo filter app for the first time. Most of photo filter apps has a slider to control intensity of filters they provide. I know how to change intensity with inputIntensity parameter...like this..

filter.setValue(intensity, forKey:"inputIntensity")

For example, CIColorMonocrome take inputIntensity parameter but most of color adjustment filters on Core Image Filter Reference page doesn't have inputIntensity parameter.. In that case, how to control intensity of filter effect I want to create??

Especially if I combine multiple effects and let users control intensity of the filter combined multiple color correction...?

Any pointer will be welcomed...!

Upvotes: 0

Views: 940

Answers (1)

Frank Rupprecht
Frank Rupprecht

Reputation: 10408

What you see as "intensity" in many apps is a simple alpha blending: You apply the filter, set the alpha (opacity) of the resulting image to your desired intensity value, and blend that image over the original. So the original "shines through" based on the intensity.

See this answer on how you can do that with Core Image.

Upvotes: 2

Related Questions