ImageProcessor

public protocol ImageProcessor

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

  • 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 retrived with proper key.

    Note

    Do not supply an empty string for a customized processor, which is already taken by the DefaultImageProcessor. It is recommended to use a reverse domain name notation string of your own for the identifier.

    Declaration

    Swift

    var identifier: String
  • Process an input ImageProcessItem item to an image for this processor.

    Note

    The return value will be nil if processing failed while converting data to image. If input item is already an image and there is any errors in processing, the input image itself will be returned.

    Note

    Most processor only supports CG-based images. watchOS is not supported for processers containing filter, the input image will be returned directly on watchOS.

    Declaration

    Swift

    func process(item: ImageProcessItem, options: KingfisherOptionsInfo) -> Image?

    Parameters

    item

    Input item which will be processed by self

    options

    Options when processing the item.

    Return Value

    The processed image.

  • append(another:) Extension method

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

    Declaration

    Swift

    public func append(another: ImageProcessor) -> ImageProcessor

    Parameters

    another

    An ImageProcessor you want to append to self.

    Return Value

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