iosobjective-cuiimagepixelate

How to pixelate an image in iOS?


I'm to create a simple app with the following features:

  1. First page of app will display a list of images from server (when we display these images we should pixelate it).

  2. Once user clicks on any pixelated image then it will open in detail view (opens that pixelated image in a new ViewController).

When the user does a single touch on the detail view controller image, then it will reduce its pixelation level, and after some clicks the user can see the real image.

My problem is I am not able to find out a way to pixelate all these things dynamically. Please help me.


Solution

  • The GPUImage Framework has a pixellate filter, since it uses the GPUAcceleration applying the filter on an image is very fast and you can vary the pixellate level at runtime.

    UIImage *inputImage = [UIImage imageNamed:<#yourimageame#>];
    GPUImagePixellateFilter *filter = [[GPUImagePixellateFilter alloc] init];
    UIImage *filteredImage = [filter imageByFilteringImage:inputImage];