Kingfisher Documentation

Protocol Image​Processor

public protocol ImageProcessor  

An ImageProcessor would be used to convert some downloaded data to an image.

%37 ImageProcessor ImageProcessor DownsamplingImageProcessor DownsamplingImageProcessor DownsamplingImageProcessor->ImageProcessor RoundCornerImageProcessor RoundCornerImageProcessor RoundCornerImageProcessor->ImageProcessor ResizingImageProcessor ResizingImageProcessor ResizingImageProcessor->ImageProcessor CIImageProcessor CIImageProcessor CIImageProcessor->ImageProcessor CroppingImageProcessor CroppingImageProcessor CroppingImageProcessor->ImageProcessor BlurImageProcessor BlurImageProcessor BlurImageProcessor->ImageProcessor GeneralProcessor GeneralProcessor GeneralProcessor->ImageProcessor TintImageProcessor TintImageProcessor TintImageProcessor->ImageProcessor BlendImageProcessor BlendImageProcessor BlendImageProcessor->ImageProcessor OverlayImageProcessor OverlayImageProcessor OverlayImageProcessor->ImageProcessor ColorControlsProcessor ColorControlsProcessor ColorControlsProcessor->ImageProcessor BlackWhiteProcessor BlackWhiteProcessor BlackWhiteProcessor->ImageProcessor CompositingImageProcessor CompositingImageProcessor CompositingImageProcessor->ImageProcessor DefaultImageProcessor DefaultImageProcessor DefaultImageProcessor->ImageProcessor

Types Conforming to Image​Processor

CIImageProcessor

Represents a processor based on a CIImage Filter. It requires a filter to create an ImageProcessor.

DefaultImageProcessor

The default processor. It converts the input data to a valid image. Images of .PNG, .JPEG and .GIF format are supported. If an image item is given as .image case, DefaultImageProcessor will do nothing on it and return the associated image.

BlendImageProcessor

Processor for adding an blend mode to images. Only CG-based images are supported.

CompositingImageProcessor

Processor for adding an compositing operation to images. Only CG-based images are supported in macOS.

RoundCornerImageProcessor

Processor for making round corner images. Only CG-based images are supported in macOS, if a non-CG image passed in, the processor will do nothing.

ResizingImageProcessor

Processor for resizing images. If you need to resize a data represented image to a smaller size, use DownsamplingImageProcessor instead, which is more efficient and uses less memory.

BlurImageProcessor

Processor for adding blur effect to images. Accelerate.framework is used underhood for a better performance. A simulated Gaussian blur with specified blur radius will be applied.

OverlayImageProcessor

Processor for adding an overlay to images. Only CG-based images are supported in macOS.

TintImageProcessor

Processor for tint images with color. Only CG-based images are supported.

ColorControlsProcessor

Processor for applying some color control to images. Only CG-based images are supported. watchOS is not supported.

BlackWhiteProcessor

Processor for applying black and white effect to images. Only CG-based images are supported. watchOS is not supported.

CroppingImageProcessor

Processor for cropping an image. Only CG-based images are supported. watchOS is not supported.

DownsamplingImageProcessor

Processor for downsampling an image. Compared to ResizingImageProcessor, this processor does not render the images to resize. Instead, it downsamples the input data directly to an image. It is a more efficient than ResizingImageProcessor. Prefer to use DownsamplingImageProcessor as possible as you can than the ResizingImageProcessor.

Default Implementations

append(another:​)

public func append(another: ImageProcessor) -> ImageProcessor  

Appends an ImageProcessor to another. The identifier of the new ImageProcessor will be "(self.identifier)|>(another.identifier)".

Parameters

another Image​Processor

An ImageProcessor you want to append to self.

Returns

The new ImageProcessor will process the image in the order of the two processors concatenated.

Requirements

identifier

var identifier: String  

Identifier of the processor. It will be used to identify the processor when caching and retrieving an image. You might want to make sure that processors with same properties/functionality have the same identifiers, so correct processed images could be retrieved with proper key.

process(item:​options:​)

func process(item: ImageProcessItem, options: KingfisherParsedOptionsInfo) -> KFCrossPlatformImage? 

Processes the input ImageProcessItem with this processor.

Parameters

item Image​Process​Item

Input item which will be processed by self.

options Kingfisher​Parsed​Options​Info

The parsed options when processing the item.

Returns

The processed image.