swift - Image roates after CIFilter applied -
i'm applying cifilter image gets rotated after filter applied. found solution here in objective-c, how in swift? code below.
let originalimage = ciimage(image: camerastill.image) var filter = cifilter(name: "ciphotoeffect"+x) filter.setdefaults() filter.setvalue(originalimage, forkey: kciinputimagekey) var outputimage = filter.outputimage var newimage = uiimage(ciimage: outputimage) v.setimage(newimage, forstate: .normal)
the code below worked fine me:
var image = uiimage(named: "turtle") let ciimage = ciimage(image: image) let filter = cifilter(name: "cisepiatone") filter.setvalue(ciimage, forkey: kciinputimagekey) filter.setvalue(1.5, forkey: kciinputintensitykey) let newimage = uiimage(ciimage: filter.outputimage) let imageview = uiimageview(image: newimage) self.view.addsubview(imageview)
let me know how go.
Comments
Post a Comment