ResizingImageProcessor
public struct ResizingImageProcessor : ImageProcessor
Processor for resizing images.
If you need to resize a data represented image to a smaller size, use DownsamplingImageProcessor
instead, which is more efficient and takes less memory.
-
Identifier of the processor.
Note
See documentation ofImageProcessor
protocol for more.Declaration
Swift
public let identifier: String
-
The reference size for resizing operation in point.
Declaration
Swift
public let referenceSize: CGSize
-
Target content mode of output image should be. Default is
.none
.Declaration
Swift
public let targetContentMode: ContentMode
-
Creates 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 in point.
mode
Target content mode of output image should be.
-
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.