bicubicScaleTransform()
Produces a high-quality scaled version of an image.
Declaration
class func bicubicScaleTransform() -> any CIFilter & CIBicubicScaleTransformReturn 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:
inputImageAn image with the type CIImage.
aspectRatioA
floatrepresenting the aspect ratio as an NSNumber.parameterBA
floatrepresenting the value of B used for cubic resampling as an NSNumber.parameterCA
floatrepresenting 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]