Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How-to generate a QR code with the logo in the middle using CIQRCodeGenerator

I am trying to generate a QR code that has a logo in the middle, as it is: enter image description here.

I am using a code I found here, my code is:

func generateQrCode(message: String!) -> CIImage! {

    var data = message.dataUsingEncoding(NSUTF8StringEncoding, allowLossyConversion: false)

    var filter: CIFilter = CIFilter(name: "CIQRCodeGenerator")
    filter.setValue(data, forKey: "inputMessage")
    filter.setValue("H", forKey: "inputCorrectionLevel")

    return filter.outputImage
}

How could adapt the code to generate a QR with a custom logo in the middle?

like image 214
Rodrigo Moreno Avatar asked Mar 02 '15 01:03

Rodrigo Moreno


1 Answers

Just overlay the middle part with the logo. The QR spec isn't going to some version that has a logo in the middle. The logo is just garbage that the error handling of the QR code reader handles. You don't want to make the logo too big, or else it won't be readable because of too many errors.

http://en.wikipedia.org/wiki/QR_code#Error_correction

like image 129
bryan Avatar answered Sep 30 '22 03:09

bryan