Auto enhance UIImageView with no rotation

  • Thread starter barrylachapelle
  • Start date


I have been at this for two days now and hopefully, you can help me out. I am trying to auto-enhance an image from UIImageView. The following code is rotating and resizing images SOMETIMES and I'm having a hard time determining when or why. From the lack of posts on the topic, I feel like I must be missing something super simple. Thank you ALL!

// my UIImageView is self.imgOut

var enhanceImg = CIImage(image: self.imgOut.image!)

let filters = enhanceImg!.autoAdjustmentFilters(options: nil)

for filter: CIFilter in filters {
filter.setValue(enhanceImg, forKey: kCIInputImageKey)
enhanceImg = filter.outputImage!

let enhancedImg = UIImage(ciImage: enhanceImg!, scale: self.imgOut.image!.scale, orientation: self.imgOut.image!.imageOrientation)
self.imgOut.image = enhancedImg

Continue reading...