[翻译] ios-image-filters
ios-image-filters

https://github.com/esilverberg/ios-image-filters
photoshop-style filter interface for UIImage class on iOS to make instagram-style images
photoshop-风格的滤镜接口,可以像使用photshop那样子来配置图片。
ios-image-filters
These days everyone seems to want instagram-style filters for images on iPhone. The way to do this (I think) 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.
这些日子里,大家都想用具备设置风格的滤镜来处理图片。为了达到这个目的,大家需要研究Photoshop中使用的滤镜以及OC代码中等效的滤镜,很不幸,这些图片滤镜全部都是为游戏开发设计,对于非游戏开发人员,即使只想用最简单的图片处理,这也无异于自杀。
It's like photoshop for the UIImage class!
I've worked hard to mimic the photoshop color adjustment menus. Turns out these are clutch in pretty much all the best image filters you can name right now (lomo, polaroid). For example, if you want to manipulate levels, here's your method, built straight onto the UIImage class:
只是模拟photoshop的颜色平衡的菜单都费了好大的劲。为了调节到能达到指定的效果花了好多好多时间。不过已经很好用了,你可以看如下的例子:
- (UIImage*) levels:(NSInteger)black mid:(NSInteger)mid white:(NSInteger)white
An API just like that cool menu in Photoshop!
Want to do a curves adjustment to mimic a filter you saw on a blog? Just do this:
一个API与Photoshop中的一个菜单非常相似!
能够微调一个滤镜的效果么?用以下的方式即可:
NSArray *redPoints = [NSArray arrayWithObjects:
[NSValue valueWithCGPoint:CGPointMake(0, 0)],
[NSValue valueWithCGPoint:CGPointMake(93, 76)],
[NSValue valueWithCGPoint:CGPointMake(232, 226)],
[NSValue valueWithCGPoint:CGPointMake(255, 255)],
nil];
NSArray *bluePoints = [NSArray arrayWithObjects:
[NSValue valueWithCGPoint:CGPointMake(0, 0)],
[NSValue valueWithCGPoint:CGPointMake(57, 59)],
[NSValue valueWithCGPoint:CGPointMake(220, 202)],
[NSValue valueWithCGPoint:CGPointMake(255, 255)],
nil];
UIImage *image = [[[UIImage imageNamed:@"landscape.jpg" applyCurve:redPoints toChannel:CurveChannelRed]
applyCurve:bluePoints toChannel:CurveChannelBlue];
The problem with my curves implementation is 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 port to iOS. But, the curves I use (catmull-rom) seem close enough.
其实还是有问题的,因为我实现的方式与Photoshop并不一致。主要原因是,我不知道Photoshop的相关滤镜是怎么实现出来的,我只能从iOS的找到类似的效果来替换。
How to integrate
Copy and paste the ImageFilter.* and Curves/* classes into your project. It's implemented a Category on UIImage.
怎么使用呢?复制粘贴ImageFilter.*与Curves.*类到你的项目工程中。他们都是UIImage的category的方式实现的,简单易用。
How to use
#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];
What is still broken
- Gaussian blur is slow! 高斯模糊很慢!
- More blend modes for layers 更多的针对Layer的混合模式
- Curves are catmull rom, not bicubic ???
- So much else... 就这些...
Other options
I tried, but mostly failed, to understand these libraries. Simple Image Processing is 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...
为了理解这些库怎么用,我试过了,但绝大部分都失败了。简单的图片处理是很简单的,包括用CPP类来实现这些效果,还有CImg。我发现CPP的语法格式太恐怖而放弃了。我尝试了GLImageProcessing几个小时候,因为实在不知道他们是怎么出来效果的-_-!!,也许我该试一下CS244a...
UPDATE: Core image filters in iOS5 are probably what you want to use going forward, though they are not backwards-compatible with iOS4 or earlier.
更新:在iOS5上,Core image滤镜就是你以后要使用的工具了,虽然他们不会向前兼容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 is MIT-licensed.http://en.wikipedia.org/wiki/MIT_License
There is also now code adapted from ImageMagick, whose license may be found at:http://www.imagemagick.org/script/license.php
[翻译] ios-image-filters的更多相关文章
- [翻译] iOS开发工具的介绍(第一部分)
IOS DEVELOPMENT TIPS & TRICKS - PART I http://blog.trifork.com/2013/12/19/ios-development-tips-t ...
- [翻译] 5点建议,让iOS程序跑得更快
[文章原地址]http://mobile.tutsplus.com/tutorials/iphone/ios-quick-tip-5-tips-to-increase-app-performanc ...
- iOS界面设计切图小结
iOS界面设计切图小结 APR 12TH, 2013 1.基本尺寸 (1)界面 实际设计时按: iPhone4.4s:640px*960px iPhone5: 640px*1136px iPad:15 ...
- iOS的设计备忘录/资源集合(新手快速开发)
iOS的设计备忘录 随着iOS7更新,风格走上扁平化,大部分iOS设计师及程序员都需要对自己的软件做相关调整,尺寸.Icon.UI等等,我在这里总结一下相关资料,以及提供一些关于iOS7设计素材. 一 ...
- html5手机常见问题与工具分享
mobileTech A useful tools or tips list for mobile web application developing 这个项目收集移动端开发所需要的一些资源与小技巧 ...
- Aquarium Filtration
http://www.fishyou.com/aquarium-filtration.php Aquarium Filtration This section covers aquarium filt ...
- mobileTech
A useful tools or tips list for mobile web application developing 这个项目收集移动端开发所需要的一些资源与小技巧 工具类网站 HTML ...
- (任寒韬)WebApp群主 - MobileTech 资料
web app : http://www.lightapp.cn/brand/index/4101 https://github.com/jtyjty99999/mobileTech/blob/mas ...
- 自己动手做聊天机器人 二十九-重磅:近1GB的三千万聊天语料供出
Reference: http://www.shareditor.com/blogshow/?blogId=112 经过半个月的倾力打造,建设好的聊天语料库包含三千多万条简体中文高质量聊天语料,近1G ...
- 学习笔记CB010:递归神经网络、LSTM、自动抓取字幕
递归神经网络可存储记忆神经网络,LSTM是其中一种,在NLP领域应用效果不错. 递归神经网络(RNN),时间递归神经网络(recurrent neural network),结构递归神经网络(recu ...
随机推荐
- 自然语言处理--Word2vec(一)
一.自然语言处理与深度学习 自然语言处理应用 深度学习模型 为什么需要用深度学习来处理呢 二.语言模型 1.语言模型实例: 机器翻译 拼写纠错 ...
- GRU
GRU模型(比LSTM减少了计算量) LSTM的模型,LSTM的重复网络模块的结构很复杂,它实现了三个门计算,即遗忘门.输入门和输出门. 而GRU模型如下,它只有两个门了,分别为更新门和重置门,即图中 ...
- 06-python中的装饰器
java类中, 有一系列的装饰器, 尤其对文件的操作, python的装饰器比较简单, 直接上代码 #!/usr/bin/env python3 #coding:utf- ''' python的装饰器 ...
- php的explode()和split()的区别
都是分割,区别就是,split要用转移字符: 1. $test = end(explode('.', 'abc.txt')); echo $test;//output txt 2. ...
- Cookie文件说明及IE的Cookie文件格式
1.Cookie文件的实质 Cookie实际上是Web服务端与客户端(典型的是浏览器)交互时彼此传递的一部分内容,内容可以是任意的,但要在允许的长度范围之内.客户端会将它保存在本地机器上(如IE便会保 ...
- JAVA 之 多态 抽象 接口
一:多态 1:多态 一个对象有多种形式的能力 2:步骤 1编写父类派生子类 2子类重写父类方法 3用父类的数据类型引用子类对象 3:静态多态的实现方式就是方法重载 4:动态多态的实现方式就是重写 ...
- 多表连接的三种方式详解 HASH JOIN MERGE JOIN NESTED LOOP
在多表联合查询的时候,如果我们查看它的执行计划,就会发现里面有多表之间的连接方式. 之前打算在sqlplus中用执行计划的,但是格式看起来有点乱,就用Toad 做了3个截图. 从3张图里我们看到了几点 ...
- rails安全性
如果你发布你的blog.那么其他人就可以随便修改和添加博客了. Rails提供了一个非常简单的http认证系统,可以非常有帮助的解决这种情况. 在PostsController里面我们需要一个方法阻止 ...
- [转]验证发生前无法调用 Page.IsValid。应在 CausesValidation=True 且已启动回发的控件
在ASP.Net中,为了方便表单的验证,提供了验证控件来完成表单输入数据的验证.这些验证控件确实是功能强大,为写表单程序提供了极大的便利.但是,在不熟悉的情况下,经常碰到问题.其中,最常见的是遇到错误 ...
- docker1-安装和使用
docker安装和使用 一.安装docker 1.1 centos7.2安装docker 环境:centos7.2 安装方法:https://docs.docker.com/engine/instal ...