Contents

bicubicScaleTransform()

Produces a high-quality scaled version of an image.

Declaration

class func bicubicScaleTransform() -> any CIFilter & CIBicubicScaleTransform

Return Value

The adjusted image.

Discussion

This method applies the bicubic scale transform filter to an image. The effect produces a high-quality, scaled version of the input image. The parameters of B and C determine the sharpness and softness of the resampling.

The bicubic scale transform filter uses the following properties:

inputImage

An image with the type CIImage.

aspectRatio

A float representing the aspect ratio as an NSNumber.

parameterB

A float representing the value of B used for cubic resampling as an NSNumber.

parameterC

A float representing the value of C used for cubic resampling as an NSNumber.

The following code creates a filter that results in the image becoming square:

func bicubicScale(inputImage: CIImage) -> CIImage {
    let bicubicScaleFilter = CIFilter.bicubicScaleTransform()
    bicubicScaleFilter.inputImage = inputImage
    bicubicScaleFilter.aspectRatio = 0.7
    bicubicScaleFilter.parameterB = 1
    bicubicScaleFilter.parameterC = 0.75
    return bicubicScaleFilter.outputImage!
}

[Image]

See Also

Filters