Color Specific Hue/Saturation from Photoshop to iO

2019-05-25 08:56发布

I'm trying to use GPUImage and CIFilter to map this filter. Please note, I need help mapping the color (Reds) specific (note: NOT Master, just Reds) photoshop element to iOS.

Does anyone know how to manipulate a CIFilter or GPUImage class to get the photoshop effect below in iOS?

enter image description here

1条回答
戒情不戒烟
2楼-- · 2019-05-25 09:17

You could use GPUImage with the lookup filter:

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.

So apply all color filters in the lookup.png file from GPUImage in Photoshop, save it, then apply the filter:

- (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;
}
查看更多
登录 后发表回答