ResizingImageProcessor

public struct ResizingImageProcessor: ImageProcessor

Processor for resizing images. Only CG-based images are supported in macOS.

  • Identifier of the processor.

    Note

    See documentation of ImageProcessor protocol for more.

    Declaration

    Swift

    public let identifier: String
  • The reference size for resizing operation.

    Declaration

    Swift

    public let referenceSize: CGSize
  • Target content mode of output image should be. Default to ContentMode.none

    Declaration

    Swift

    public let targetContentMode: ContentMode
  • Initialize a ResizingImageProcessor.

    Note

    The instance of ResizingImageProcessor will follow its mode property and try to resizing the input images to fit or fill the referenceSize. That means if you are using a mode besides of .none, you may get an image with its size not be the same as the referenceSize.

    Example: With input image size: {100, 200}, referenceSize: {100, 100}, mode: .aspectFit, you will get an output image with size of {50, 100}, which fits the referenceSize.

    If you need an output image exactly to be a specified size, append or use a CroppingImageProcessor.

    Declaration

    Swift

    public init(referenceSize: CGSize, mode: ContentMode = .none)

    Parameters

    referenceSize

    The reference size for resizing operation.

    mode

    Target content mode of output image should be.

  • Process an input ImageProcessItem item to an image for this processor.

    Note

    See documentation of ImageProcessor protocol for more.

    Declaration

    Swift

    public 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.