ResizingImageProcessor
public struct ResizingImageProcessor: ImageProcessor
Processor for resizing images. Only CG-based images are supported in macOS.
-
Identifier of the processor.
Note
See documentation ofImageProcessor
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 itsmode
property and try to resizing the input images to fit or fill thereferenceSize
. That means if you are using amode
besides 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
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.