[Translate] Ios-image-filters

Source: Internet
Author: User
Tags image filter imagemagick

Ios-image-filters

Https://github.com/esilverberg/ios-image-filters

Photoshop-style Filter interface for UIImage class on IOS to make Instagram-style images

The photoshop--style filter interface allows you to configure images as you would with Photshop.

Ios-image-filters

These days everyone seems to want Instagram-style filters for images on IPhone. The the-the-think-is-examine how people has implemented equivalent filters in Photoshop and code them in OB Jective C. Unfortunately, the imaging libraries is all geared for gaming. For non-game developers-just want simple image processing, the is overkill.

These days, people want to use a set style filter to work with pictures. To achieve this, you need to study the filters used in Photoshop and the equivalent filters in the OC code, unfortunately, all of these image filters are designed for the game, and for non-game developers, even if you just want to use the simplest image processing, this is tantamount to suicide.

It ' s like Photoshop for the UIImage class!

I ' ve worked hard to mimic the Photoshop color adjustment menus. Turns out these is clutch in pretty much all the "best Image Filters" can name right now (Lomo, Polaroid). For example, if you want-manipulate levels, here's your method, built straight onto the UIImage class:

Just a menu that simulates the color balance of Photoshop is a great effort. It took a lot of time to adjust to the desired effect. However, it is very useful, you can see the following example:

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

An API just like that cool menu in photoshop!

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

An API is very similar to a menu in Photoshop!

Can you fine-tune the effect of a filter? You can do this in the following ways:

  Nsarray *redpoints = [Nsarray arraywithobjects: [Nsvalue valuewithcgpoint:cgpointmake (0, 0)], [NS Value Valuewithcgpoint:cgpointmake, [Nsvalue valuewithcgpoint:cgpointmake (232, 226)], [Nsvalue valu Ewithcgpoint:cgpointmake (255, 255)], nil]; Nsarray *bluepoints = [Nsarray arraywithobjects: [Nsvalue valuewithcgpoint:cgpointmake (0, 0)], [NSValue VA Luewithcgpoint:cgpointmake, [Nsvalue Valuewithcgpoint:cgpointmake (+ 202)], [Nsvalue valuewithc Gpoint:cgpointmake (255, 255)], nil]; UIImage *image = [[[UIImage imagenamed:@ ' landscape.jpg ' applycurve:redpoints tochannel:curvechannelred] ApplyCurve: Bluepoints Tochannel:curvechannelblue];  

The problem with my curves implementation are that I didn ' t use the same kind of curve algorithm as Photoshop uses. Mainly, because I don ' t know how, and other than the name of the curve (Bicubic) all the posts and documentation I simply Don ' t understand or cannot figure out how to the port to IOS. But, the Curves I use (catmull-rom) seem close enough.

There are still problems, because the way I do it is not consistent with Photoshop. The main reason is that I don't know how Photoshop's related filters are implemented, and I can only replace them with similar effects found in iOS.

How to integrate

Copy and paste the imagefilter.* and curves/* classes into your project. It ' s implemented a Category on UIImage.

How to use it? Copy and paste imagefilter.* and curves.* classes into your project project. They are all uiimage in the category of the way to achieve, easy to use.

How to use

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

What is still broken

    • Gaussian Blur is slow! Gaussian blur is slow!
    • More blend modes for layers more layer-specific blending modes
    • Curves is Catmull ROM, not bicubic ???
    • So much else ... that's all .

Other options

I tried, but mostly failed, to understand these libraries. Simple Image processing are too simple, and uses a CPP class to accomplish its effects, as does CImg. I find the CPP syntax ghoulish, to say the least. I stared at the glimageprocessing code for hours, and still don't understand what ' s going on. Guess I should have taken cs244a ...

I tried to understand how these libraries were used, but most of them failed. Simple picture processing is simple, including the use of CPP class to achieve these effects, as well as cimg. I found that the CPP syntax format was too scary to give up. I tried glimageprocessing a few hours, because I really do not know how they came out of the effect of-_-!!, maybe I should try cs244a ...

Update:core Image filters in iOS5 is probably what's want to use going forward, though they is not backwards-compatib Le with IOS4 or earlier.

Update: On iOS5, the Core image filter is the tool you will use later, although they will not be forward compatible with previous versions of IOS4.

    • Core Image filters:http://developer.apple.com/library/mac/#documentation/graphicsimaging/reference/ Coreimagefilterreference/reference/reference.html
    • Simple Image processing:http://code.google.com/p/simple-iphone-image-processing/
    • glimageprocessing:http://developer.apple.com/library/ios/#samplecode/glimageprocessing/introduction/intro.html
    • Cimg:http://cimg.sourceforge.net/reference/group__cimg__tutorial.html

License

MIT License, where applicable. I borrowed code from this project:http://sourceforge.net/projects/curve/files/, which also indicates it's mit-licensed.h Ttp://en.wikipedia.org/wiki/mit_license

There is also now code adapted from ImageMagick, whose license could be found AT:HTTP://WWW.IMAGEMAGICK.ORG/SCRIPT/LICENSE.P Hp

[Translate] Ios-image-filters

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.