I use this function to detect if UIImage has transparency:
extension UIImage { public func isTransparent() -> Bool { guard let alpha: CGImageAlphaInf