DownsamplingImageProcessor

public struct DownsamplingImageProcessor : ImageProcessor

Processor for downsampling an image. Compared to ResizingImageProcessor, this processor does not render the images to resize. Instead, it downsample the input data directly to an image. It is a more efficient than ResizingImageProcessor.

Only CG-based images are supported. Animated images (like GIF) is not supported.

  • Target size of output image should be. It should be smaller than the size of input image. If it is larger, the result image will be the same size of input data without downsampling.

    Declaration

    Swift

    public let size: CGSize
  • Identifier of the processor.

    Note

    See documentation of ImageProcessor protocol for more.

    Declaration

    Swift

    public let identifier: String
  • Creates a DownsamplingImageProcessor.

    Declaration

    Swift

    public init(size: CGSize)

    Parameters

    size

    The target size of the downsample operation.

  • Processes the input ImageProcessItem with this processor.

    Note

    See documentation of ImageProcessor protocol for more.

    Declaration

    Swift

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

    Parameters

    item

    Input item which will be processed by self.

    options

    Options when processing the item.

    Return Value

    The processed image.