user6567889 user6567889 - 7 months ago 51
Swift Question

How I can mirror an image after selecting through image picker using swift?

@IBAction func mirrorBtn(sender: AnyObject)


pickImage.image = imageView


func makeMirroredImage(image: UIImage) -> UIImage {
var flippedOrientation: UIImageOrientation = .UpMirrored
switch image.imageOrientation {
case .Down:
flippedOrientation = .DownMirrored
case .Left:
flippedOrientation = .LeftMirrored
default :
flippedOrientation = .LeftMirrored

let flippedImage: UIImage = UIImage(CGImage: image.CGImage!, scale: image.scale, orientation: flippedOrientation)
return flippedImage


After the image is selected you should be able to invert it using a translation. I'm not a professional with iOS/swift, but in Android I accomplished this by setting the X and Y translation to -1. Hope this puts you on the right track