Resize CIImage

  1. last year

    Good afternoon,
    I try to resize a CIImage to be exactly VECTORSIZE times VECTORSIZE bits.

    var width = (Int(image!.extent.size.width))
        var height = (Int(image!.extent.size.height))
        
        let imgScale = Double(VECTORSIZE) / Double(height)
        
        let scaleTransform = CIFilter(name: "CILanczosScaleTransform")
        scaleTransform!.setValue(grey!.valueForKey("outputImage") as! CIImage, forKey: kCIInputImageKey)
        scaleTransform!.setValue(imgScale, forKey: kCIInputScaleKey)
        scaleTransform!.setValue(Double(height)/Double(width), forKey: "inputAspectRatio")


    However, sometimes the I get VECTORSIZE+1 sized images. Is there a another CIFilter I can use to specify the exact size of the resulting CIImage? If you have a function at hand including the parameters, I'd be really thankful.
    Regards,
    Mercator

or Sign Up to reply!