Image Filters

Verious Support
August 08, 2012
Package Details

Available on: Verious

These days everyone seems to want Instagram-style filters for images on iPhone. One way to do this is to examine how people have implemented equivalent filters in Photoshop and code them in Objective C. Unfortunately, the imaging libraries are all geared for gaming. For non-game developers who just want simple image processing, this is overkill.

Therefore, Image Filters was created for overall simple image processing. The code is a Photoshop-style filter interface for UIImage class on iOS to make Instagram-style images. It is great for all the best image filters (i.e. lomo & polaroid). Using this code is super simple. For example, if you want to manipulate levels, here's your method, built straight onto the UIImage class:

- (UIImage*) levels:(NSInteger)black mid:(NSInteger)mid white:(NSInteger)white

Want to do a curves adjustment to mimic a filter you saw on a blog? Just do this: 

NSArray *redPoints = [NSArray arrayWithObjects:
        [NSValue valueWithCGPoint:CGPointMake(0, 0)],
        [NSValue valueWithCGPoint:CGPointMake(93, 76)],
        [NSValue valueWithCGPoint:CGPointMake(232, 226)],
        [NSValue valueWithCGPoint:CGPointMake(255, 255)],
NSArray *bluePoints = [NSArray arrayWithObjects:
         [NSValue valueWithCGPoint:CGPointMake(0, 0)],
         [NSValue valueWithCGPoint:CGPointMake(57, 59)],
         [NSValue valueWithCGPoint:CGPointMake(220, 202)],
         [NSValue valueWithCGPoint:CGPointMake(255, 255)],
UIImage *image = [[[UIImage imageNamed:@"landscape.jpg" applyCurve:redPoints toChannel:CurveChannelRed] 
 applyCurve:bluePoints toChannel:CurveChannelBlue];

To get started simply copy and paste the ImageFilter.* and Curves/* classes into your project. It's implemented a Category on UIImage.


#import "ImageFilter.h"
UIImage *image = [UIImage imageNamed:@"landscape.jpg"];
self.imageView.image = [image sharpen];
// Or
self.imageView.image = [image saturate:1.5];
// Or
self.imageView.image = [image lomo];