Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cant save to png file #30

Open
jaydenhe opened this issue Mar 22, 2017 · 1 comment
Open

cant save to png file #30

jaydenhe opened this issue Mar 22, 2017 · 1 comment

Comments

@jaydenhe
Copy link

UIImagePNGRepresentation always return nil

by the way:
qrImageView.image = QRCode.generateImage(Token.base64EncodedString(), avatarImage:nil)

if let qrImage = qrImageView.image {
let vc = UIActivityViewController(activityItems: [qrImage] as [Any], applicationActivities: [])
self.present(vc, animated: true, completion: nil)
}
I cant share the QRCode

@Geeroz
Copy link

Geeroz commented Apr 21, 2017

my work around was to draw the qrImage in context then save from there.

let QRImage = QRCode.generateImage(qrString, avatarImage: nil, color: CIColor.init(red: 0.99, green: 0.27, blue: 0.12), backColor: CIColor.init(red: 1.0, green: 1.0, blue: 1.0, alpha: 0.0))
        
UIGraphicsBeginImageContext(CGSize(width: 360, height: 360))
QRImage?.draw(in: CGRect(x: 0, y: 0, width: 360, height: 360))
let contextImage = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()

data = UIImagePNGRepresentation(contextImage);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants