Post

Replies

Boosts

Views

Activity

Custom Filter Code Help
HiHope all is well?I'm trying to make my own app and have run into my first issue hahaI'm a cinematographer that makes LUTS for cinematographers for many different camera platforms. I also make them for iPhone users so I want to create my own app so they can use them in the phone/app rather then on a computer.Long story short, LUTS are kinda like filters, Instagram filters etc.....But instead of applying a typical Apple filter like CISepiaTone etcWhen the users applies the filters from the app, I need the filter to be applied from a png file not a Apple filterI know it's possible but I can't seem to find a code that works.So basically, users import a picture/video from their photo library, they then apply the filter and save it to their phone.I just need it to apply my own filters from png files not a CI FilterThis is my code so far:import UIKitclass ViewController: UIViewController, UINavigationControllerDelegate, UIImagePickerControllerDelegate { @IBOutlet weak var imageView: UIImageView! override func viewDidLoad() { super.viewDidLoad() / } func importImage(_ sender: Any) { let image = UIImagePickerController() image.delegate = self image.sourceType = UIImagePickerControllerSourceType.photoLibrary image.allowsEditing = true self.present(image, animated: true) { / } } func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) { if let image = info[UIImagePickerControllerOriginalImage] as? UIImage { imageView.image = image}else{ /}self.dismiss(animated: true, completion: nil)} func filterAction(_ sender: Any) { guard let image = self.imageView.image?.cgImage else { return } let openGLContext = EAGLContext(api: .openGLES3) let context = CIContext(eaglContext: openGLContext!) let ciImage = CIImage(cgImage: image) let filter = CIFilter(name: "CISepiaTone") filter?.setValue(ciImage, forKey: kCIInputImageKey) filter?.setValue(1, forKey: kCIInputIntensityKey) if let output = filter?.value(forKey: kCIOutputImageKey) as? CIImage { self.imageView?.image = UIImage(cgImage: context.createCGImage(output, from: output.extent)!) } / } }so the last filter action I need to change from a CI filter to filter with my png fileAny ideas? im using Xcode 8.2.1 with Swift Please email me here danieljohnpeters@yahoo.comMany thanks in advance
1
0
728
Jan ’17