CocoaPods trunk is moving to be read-only. Read more on the blog, there are 18 months to go.
TestsTested | ✗ |
LangLanguage | Obj-CObjective C |
License | MIT |
ReleasedLast Release | Nov 2017 |
Maintained by Vitalii Parovishnyk.
Replicate Instragram-style filters in Objective-C (Swift 3.0 Compatibility).
It is built upon GPUImage, written open sourced framework by Brad Larson that hanles low-level GPU interactions on IGRFilterCombine's behalf.
The GPUImage framework is a BSD-licensed iOS library that lets you apply GPU-accelerated filters and other effects to images, live camera video, and movies. In comparison to Core Image (part of iOS 5.0), GPUImage allows you to write your own custom filters, supports deployment to iOS 4.0, and has a simpler interface. However, it currently lacks some of the more advanced features of Core Image, such as facial detection.
For massively parallel operations like processing images or live video frames, GPUs have some significant performance advantages over CPUs. On an iPhone 4, a simple image filter can be over 100 times faster to perform on the GPU than an equivalent CPU-based filter.
Objective-C
@import IGRFilterCombine;
@interface ViewController ()
@property (nonatomic, strong) IGRFilterCombine *filterCombine;
@end
@implementation ViewController
- (void)viewDidLoad
{
[super viewDidLoad];
self.filterCombine = [[IGRFilterCombine alloc] initWithDelegate:self];
}
- (void)setupImage:(UIImage *)image
{
__weak typeof(self) weak = self;
[self.filterCombine setImage:image
completion:^(UIImage * _Nullable processedImage, NSUInteger idx) {
//Process Image
}
preview:^(UIImage * _Nullable processedImage, NSUInteger idx) {
//Process Preview
}];
}
- (NSString *)filtereNameAtIndex:(NSUInteger)imageIndex;
- (UIImage *)filteredImageAtIndex:(NSUInteger)imageIndex;
- (UIImage *)filteredPreviewImageAtIndex:(NSUInteger)imageIndex;
- (NSUInteger)count;
#pragma mark - IGRFilterCombineDelegate
- (CGSize)previewSize
{
return CGSizeMake(70.0, 70.0);
}
@end
Swift 3.0
import IGRFilterCombine
class ViewController: UIViewController {
fileprivate var filterCombine: IGRFilterCombine?
override func viewDidLoad() {
super.viewDidLoad()
filterCombine = IGRFilterCombine(delegate: self as IGRFilterCombineDelegate)
}
func setupWorkImage(_ image: UIImage) {
self.filterCombine?.setImage(image, completion: { (processedImage, idx) in
//Process Image
}) { (processedImage, idx) in
//Process Preview
}
}
self.imageView?.image = image
self.collectionView?.reloadData()
}
// MARK: - IGRFilterCombineDelegate
extension ViewController : IGRFilterCombineDelegate {
func previewSize() -> CGSize {
return CGSize(width: 70.0, height: 70.0)
}
}
open func filtereName(at imageIndex: UInt) -> String
open func filteredImage(at imageIndex: UInt) -> UIImage
open func filteredPreviewImage(at imageIndex: UInt) -> UIImage
open func count() -> UInt
}
see sample Xcode project in /Demo
IGRFilterCombine
is owned and maintained by the IGR Software and Vitalii Parovishnyk.
IGRFilterCombine
is MIT-licensed. We also provide an additional patent grant.