I am trying to flip my CIImage Horizontal with :
image = [image imageByApplyingTransform:CGAffineTransformMakeScale(1, -1)];
image = [image imageByApplyingTransform:CGAffineTransformMakeTranslation(0, sourceExtent.size.height)];
But i always get the image flip vertical instead
Try this way:
image = [image imageByApplyingTransform:CGAffineTransformMakeScale(-1, 1)];
image = [image imageByApplyingTransform:CGAffineTransformMakeTranslation(0, sourceExtent.size.height)];
This will properly flip the image horizontally and maintain proper coordinates.
In Obj-C:
image = [image imageByApplyingCGOrientation: kCGImagePropertyOrientationUpMirrored];
In Swift:
image = image.oriented(.upMirrored)
https://developer.apple.com/documentation/coreimage/ciimage/2919727-oriented
If what you want is to orient it in such a way that you can use it in an UIImage, then you want to flip it in both axes.
image = image.oriented(.downMirrored)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With