Contents

lanczosScaleTransform()

Creates a high-quality, scaled version of a source image.

Declaration

class func lanczosScaleTransform() -> any CIFilter & CILanczosScaleTransform

Mentioned in

Return Value

The adjusted image.

Discussion

This method applies the Lanczos scale transform filter to an image. The effect creates the output image by scaling the input image based on the scale and aspect ratio properties provided.

The Lanczos scale filter uses the following properties:

inputImage

An image with the type CIImage.

scale

A float representing the scaling factor used on the image as an NSNumber. Values less than 1.0 scale down the images. Values greater than 1.0 scale up the image.

aspectRatio

A float representing the additional horizontal scaling factor used on the image as an NSNumber.

The following code creates a filter that results in a smaller scaled image with high quality:

func lanczosScale(inputImage: CIImage) -> CIImage {    
    let lanczosScaleFilter = CIFilter.lanczosScaleTransform()
    lanczosScaleFilter.inputImage = inputImage
    lanczosScaleFilter.scale =  0.3
    lanczosScaleFilter.aspectRatio = 1
    return lanczosScaleFilter.outputImage!
}

[Image]

See Also

Filters