这真的让我很烦。当我将 UIImage 转换为 CIImage 时,应用过滤器然后转换回图像是倒置的(对于横向)或逆时针旋转 90 度(对于纵向)。
var image:UIImage?
var index:Int?
@IBOutlet weak var photo: UIImageView!
@IBAction func editImage(sender: UIBarButtonItem) {
println("editImage")
let beginImage = CIImage(image: self.image)
let filter = CIFilter(name: "CISepiaTone")
filter.setValue(beginImage, forKey: kCIInputImageKey)
filter.setValue(0.8, forKey: kCIInputIntensityKey)
let newImage = UIImage(CIImage: filter.outputImage)
self.photo.image = newImage
}