[翻译] 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之前的版本。

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

时间: 2024-08-05 14:58:46

[翻译] ios-image-filters的相关文章

[翻译] iOS开发工具的介绍(第一部分)

IOS DEVELOPMENT TIPS & TRICKS - PART I http://blog.trifork.com/2013/12/19/ios-development-tips-tricks-part-i/ As you might know, I am very fond of developing apps for the iOS platform. I started back in mid-2009 by trying to create an app for the Dut

iOS界面设计切图小结

iOS界面设计切图小结 APR 12TH, 2013 1.基本尺寸 (1)界面 实际设计时按: iPhone4.4s:640px*960px iPhone5: 640px*1136px iPad:1536px*2048px (2) 图标: 1024px*1024px 圆角180px 提交1024px*1024px 方角 png格式图片 2.图形部件及字体 (1) 为显示清晰 所有图形部件尺寸必须为偶数 样式中阴影.发光.描边的数值也必须为偶数 (2) 为方便用户点击 所有可点击的部件需大于88p

掘金翻译计划

原文:https://github.com/Ruixi/gold-miner 掘金翻译计划是一个翻译优质互联网技术文章的社区,文章来源为掘金上的英文分享文章.内容覆盖 Android.iOS.前端.后端.产品.设计等领域,读者为热爱新技术的新锐开 发者. 掘金翻译计划目前翻译完成 84 余篇文章,共有 108 名译者贡献翻译. 如何参与翻译 在 待认领文章列表 中认领翻译文章(如果是第一次认领,介绍一下自己就更好咯) 认领通过后,Fork 此仓库开始翻译 翻译完成,发送 Pull Request

手机那点事!已有高人把常见的不常见的坑都给找出来了,我就随便转一下了

mobileTech A useful tools or tips list for mobile web application developing 这个项目收集移动端开发所需要的一些资源与小技巧 工具类网站 HTML5 与 CSS3 技术应用评估 各种奇妙的hack 几乎所有设备的屏幕尺寸与像素密度表 移动设备参数表 ios端移动设备参数速查 浏览器兼容表 移动设备查询器 移动设备适配库 移动设备适配库2 viewport与设备尺寸在线检测器 html5 移动端兼容性速查 在线转换字体 c

[移动端]移动端上遇到的各种坑与相对解决方案

mobileHack 这里收集了许多移动端上遇到的各种坑与相对解决方案 1.问题:手机端 click 事件会有大约 300ms 的延迟 原因:手机端事件 touchstart –> touchmove –> touchend or touchcancel –> click,因为在touch事件触发之后,浏览器要判断用户是否会做出双击屏幕的操作,所以会等待300ms来判断,再做出是否触发click事件的处理,所以就会有300ms的延迟 解决方法:使用touch事件来代替click事件,如

(任寒韬)WebApp群主 - MobileTech 资料

web app : http://www.lightapp.cn/brand/index/4101 https://github.com/jtyjty99999/mobileTech/blob/master/README.md mobileTech A useful tools or tips list for mobile web application developing 这个项目收集移动端开发所需要的一些资源与小技巧 工具类网站 HTML5 与 CSS3 技术应用评估 各种奇妙的hack

[移动端]移动端上遇到的各种坑与相对解决方式

mobileHack 这里收集了很多移动端上遇到的各种坑与相对解决方式 1.问题:手机端 click 事件会有大约 300ms 的延迟 原因:手机端事件 touchstart –> touchmove –> touchend or touchcancel –> click.由于在touch事件触发之后,浏览器要推断用户是否会做出双击屏幕的操作,所以会等待300ms来推断,再做出是否触发click事件的处理.所以就会有300ms的延迟 解决方法:使用touch事件来取代click事件.如

移动技术资源

mobileTech A useful tools or tips list for mobile web application developing 这个项目收集移动端开发所需要的一些资源与小技巧 工具类网站 HTML5 与 CSS3 技术应用评估 各种奇妙的hack 几乎所有设备的屏幕尺寸与像素密度表 移动设备参数表 ios端移动设备参数速查 浏览器兼容表 移动设备查询器 移动设备适配库 移动设备适配库2 viewport与设备尺寸在线检测器 html5 移动端兼容性速查 在线转换字体 c

备:移动端开发资源和小技巧

(在github上看到的,转摘而来,如果有版权问题请联系我[email protected]) mobileTech A useful tools or tips list for mobile web application developing 这个项目收集移动端开发所需要的一些资源与小技巧 移动端统计 (from BiosSun) 可基于下方所列出的统计数据来决定您要兼容的设备及浏览器. 百度移动统计 友盟指数 CNZZ 桌面及移动端浏览器统计 全球移动端浏览器统计 工具类网站 HTML5

Aquarium Filtration

http://www.fishyou.com/aquarium-filtration.php Aquarium Filtration This section covers aquarium filtration. This is the most important aspect of fishkeeping. In fact, to your fish, this is as important as the sewage system you have! Without it you ca