CoreImage 滤镜

        let imageData = UIImagePNGRepresentation(self)

        let inputImage = CoreImage.CIImage(data: imageData!)

        let context =CIContext(options:nil)

        let filter =CIFilter(name:"CISepiaTone")

        filter!.setValue(inputImage, forKey:kCIInputImageKey)

        filter!.setValue(0.8, forKey:"inputIntensity")

        if letoutputImage = filter!.outputImage {

            let outImage = context.createCGImage(outputImage, from: outputImage.extent)

            ret urnUIImage(cgImage: outImage!)

        }

你可能感兴趣的:(CoreImage 滤镜)