Losing image orientation while converting an image to CGImage

后端 未结 7 2130
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-31 04:30

I\'m facing an image orientation issue when cropping a square portion of an image out of a rectangular original image. When image is in landscape, it\'s fine. But when it is

7条回答
  •  臣服心动
    2020-12-31 05:14

    Change your UIImage creation call to:

    finalImage = UIImage(CGImage:finalCroppedImage, scale:originalImage.scale, orientation:originalImage.orientation)
    

    to maintain the original orientation (and scale) of the image.

提交回复
热议问题