iphone - 从 Photoshop 到 iOS 的颜色特定色相/饱和度

标签 iphone ios core-image gpuimage cifilter

我正在尝试使用 GPUImage 和 CIFilter 来映射此过滤器。请注意,我需要帮助将颜色(红色)特定(注意:不是大师,只是红色)photoshop 元素映射到 iOS。

有谁知道如何在 iOS 中操作 CIFilter 或 GPUImage 类来获得下面的 photoshop 效果?

enter image description here

最佳答案

您可以将 GPUImage 与查找过滤器一起使用:

GPUImageLookupFilter: Uses an RGB color lookup image to remap the colors in an image. First, use your favourite photo editing application to apply a filter to lookup.png from GPUImage/framework/Resources. For this to work properly each pixel color must not depend on other pixels (e.g. blur will not work). If you need a more complex filter you can create as many lookup tables as required. Once ready, use your new lookup.png file as a second input for GPUImageLookupFilter.

因此,在 Photoshop 的 GPUImage 中应用 lookup.png 文件中的所有颜色滤镜,保存它,然后应用滤镜:

- (UIImage *)applyMyFilter:(UIImage*)inputImage {
    //apply custom filter
    GPUImagePicture *stillImageSource = [[GPUImagePicture alloc] initWithImage:inputImage];

    GPUImagePicture *lookupImageSource = [[GPUImagePicture alloc] initWithImage:[UIImage imageNamed:@"my-lookup.png"]];
    GPUImageLookupFilter *lookupFilter = [[GPUImageLookupFilter alloc] init];
    [stillImageSource addTarget:lookupFilter];
    [lookupImageSource addTarget:lookupFilter];

    [stillImageSource processImage];
    [lookupImageSource processImage];
    UIImage *adjustedImage = [lookupFilter imageFromCurrentlyProcessedOutput];

    return adjustedImage;
}

关于iphone - 从 Photoshop 到 iOS 的颜色特定色相/饱和度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19169043/

相关文章:

iOS SDK::vibration & 播放蜂鸣声。

ios - 在没有证书的情况下安装 Xcode 应用程序

ios - 为什么这个数组总是空的?

iphone - 如何更改测试区域设置

iphone - UIWindowController 断言失败

ios - 更改图像属性 VS Alpha 属性

ios - Core Graphics 上下文,它们是什么?

ios7 - 无法在 iOS 上将 CIImage 保存到文件而不发生内存泄漏

ios - 核心图像自动调整在 CPU 上渲染速度太慢

ios - 如何从 iOS 中的后台任务打开应用程序?