Sukhi
Sukhi

Reputation: 14135

Blur part of an image

I want to blur part of a image. I could blur the full image blurred using CIFilter ("CIGaussianBlur") but not a part of it.

For example: I want to blur the image in a small circular or square shape wherever the user taps the image.

How can I do that?

Upvotes: 2

Views: 375

Answers (2)

Jeremy Roman
Jeremy Roman

Reputation: 16345

There are several approaches. One would be to create a CIImage greyscale mask image with the shape you want, a blurred CIImage (using CIGaussianBlur), and then use CIBlendWithMask to blend them together.

The inputs of CIBlendWithMask are the input image (the blurred image), the input background image (the unblurred image), and the mask image (the shape you want). The output is the image you desire.

Upvotes: 1

Wain
Wain

Reputation: 119031

You know how to blur a whole image so you can draw the touched part of the image into a new image, blur that, and then draw it over the original at the touched point.

Upvotes: 1

Related Questions