I'm applying a CIFilter to a portrait image. For some reason, it gets rotated 90 clockwise. How can I fix this? My code is below
var imgOrientation = oImage.imageOrientation
var imgScale = oImage.scale
let originalImage = CIImage(image: oImage)
var filter = CIFilter(name: "CIPhotoEffect"+arr[sender.tag-1000])
filter.setDefaults()
filter.setValue(originalImage, forKey: kCIInputImageKey)
var outputImage = filter.outputImage
var newImage = UIImage(CIImage:outputImage, scale:imgScale, orientation:imgOrientation)
cameraStill.image = newImage
oImage
? Is the image coming from the Camera Roll? In other words, is this a photo that the user took in portrait orientation? If so, how did you obtain it? – CarminecarmitacameraStill
? You cannot convert a CIImage to a usable UIImage merely by callinginit(CIImage:...)
. – Carminecarmitainit(CIImage:)
is not suitable for direct display in an image view? – Carminecarmita