Eric
Eric

Reputation: 4061

Color Specific Hue/Saturation from Photoshop to iOS

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

Upvotes: 2

Views: 1550

Answers (1)

Lefteris
Lefteris

Reputation: 14667

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;
}

Upvotes: 2

Related Questions