Last active 3 years ago

  1. 3 years ago
    Mon 28 Mar 2016 05:01:35 PM CEST
    mercator started the conversation Resize CIImage.

    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.

  2. Mon 28 Mar 2016 03:45:52 PM CEST
    mercator joined the forum.