swift - iOS: When applying a CIFilter to a UIImage the result image is rotated -


when apply cifilter image captured camera result perfect when apply cifilter image captured front camera result not because image rotated whats wrong there??

my filter function given below

func applyfilter()->uiimage {     let cicontext = cicontext(options: nil)     let coreimage = ciimage(image: myimage!)     let filter = cifilter(name: "ciphotoeffectnoir" )     filter!.setdefaults()     filter!.setvalue(coreimage, forkey: kciinputimagekey)     let filteredimagedata = filter!.valueforkey(kcioutputimagekey) as! ciimage     let filteredimageref = cicontext.createcgimage(filteredimagedata, fromrect: filteredimagedata.extent)     var newimage = uiimage(cgimage: filteredimageref);      return newimage  } 

make sure image size before apply filters means width should less height because image/photos taken front camera have grater width length may cause problem after applying filters. https://developer.apple.com/library/content/documentation/deviceinformation/reference/iosdevicecompatibility/cameras/cameras.html


Comments

Popular posts from this blog

python - Operations inside variables -

Generic Map Parameter java -

arrays - What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it? -