ResizingImageProcessor
public struct ResizingImageProcessor: ImageProcessor
Processor for resizing images. Only CG-based images are supported in macOS.
-
Identifier of the processor.
Note
See documentation ofImageProcessorprotocol 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
ResizingImageProcessorwill follow itsmodeproperty and try to resizing the input images to fit or fill thereferenceSize. That means if you are using amodebesides of.none, you may get an image with its size not be the same as thereferenceSize.Example: With input image size: {100, 200},
referenceSize: {100, 100},mode:.aspectFit, you will get an output image with size of {50, 100}, whichfit
s thereferenceSize.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
referenceSizeThe reference size for resizing operation.
modeTarget content mode of output image should be.
-
Process an input
ImageProcessItemitem to an image for this processor.Note
See documentation of
ImageProcessorprotocol for more.Declaration
Swift
public func process(item: ImageProcessItem, options: KingfisherOptionsInfo) -> Image?Parameters
itemInput item which will be processed by
selfoptionsOptions when processing the item.
Return Value
The processed image.
View on GitHub
Install in Dash
ResizingImageProcessor Structure Reference