1
0
mirror of https://github.com/metabolist/metatext synced 2024-12-27 02:02:38 +01:00
metatext-app-ios-iphone-ipad/Extensions/UIImage+Extensions.swift
2021-02-08 20:33:49 -08:00

20 lines
442 B
Swift

// Copyright © 2021 Metabolist. All rights reserved.
import UIKit
extension UIImage {
var withProperOrientation: UIImage? {
guard imageOrientation != .up else { return self }
UIGraphicsBeginImageContextWithOptions(size, false, scale)
draw(in: .init(origin: .zero, size: size))
let image = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
return image
}
}