Nuke Documentation

Protocol Image​Processing

public protocol ImageProcessing  

Performs image processing.

For basic processing needs, implement the following method:

func process(image: PlatformImage) -> PlatformImage?

If your processor needs to manipulate image metadata (ImageContainer), or get access to more information via the context (ImageProcessingContext), there is an additional method that allows you to do that:

func process(image container: ImageContainer, context: ImageProcessingContext) -> ImageContainer?

You must implement either one of those methods.

ImageProcessing ImageProcessing ImageProcessors.CoreImageFilter ImageProcessors.CoreImageFilter ImageProcessors.CoreImageFilter->ImageProcessing ImageProcessors.GaussianBlur ImageProcessors.GaussianBlur ImageProcessors.GaussianBlur->ImageProcessing ImageProcessors.Resize ImageProcessors.Resize ImageProcessors.Resize->ImageProcessing ImageProcessors.Circle ImageProcessors.Circle ImageProcessors.Circle->ImageProcessing ImageProcessors.Composition ImageProcessors.Composition ImageProcessors.Composition->ImageProcessing ImageProcessors.Anonymous ImageProcessors.Anonymous ImageProcessors.Anonymous->ImageProcessing ImageProcessors.RoundedCorners ImageProcessors.RoundedCorners ImageProcessors.RoundedCorners->ImageProcessing

Types Conforming to Image​Processing

ImageProcessors.Resize

Scales an image to a specified size.

ImageProcessors.Circle

Rounds the corners of an image into a circle. If the image is not a square, crops it to a square first.

ImageProcessors.RoundedCorners

Rounds the corners of an image to the specified radius.

ImageProcessors.CoreImageFilter

Applies Core Image filter (CIFilter) to the image.

ImageProcessors.GaussianBlur

Blurs an image using CIGaussianBlur filter.

ImageProcessors.Composition

Composes multiple processors.

ImageProcessors.Anonymous

Processed an image using a specified closure.

Default Implementations

process(_:​context:​)

func process(_ container: ImageContainer, context: ImageProcessingContext) -> ImageContainer?  

The default implementation simply calls the basic process(_ image: PlatformImage) -> PlatformImage? method.

hashable​Identifier

var hashableIdentifier: AnyHashable  

The default impleemntation simply returns var identifier: String.

Requirements

process(_:​)

func process(_ image: PlatformImage) -> PlatformImage? 

Returns a processed image. By default, returns nil.

process(_:​context:​)

func process(_ container: ImageContainer, context: ImageProcessingContext) -> ImageContainer? 

Optional method. Returns a processed image. By default, this calls the basic process(image:) method.

identifier

var identifier: String  

Returns a string that uniquely identifies the processor.

Consider using the reverse DNS notation.

hashable​Identifier

var hashableIdentifier: AnyHashable  

Returns a unique processor identifier.

The default implementation simply returns var identifier: String but can be overridden as a performance optimization - creating and comparing strings is expensive so you can opt-in to return something which is fast to create and to compare. See ImageProcessors.Resize for an example.