Generate colorful QR code

2019-01-12 07:37发布

问题:

I want to generate the colorful QR code. I had used https://github.com/kuapay/iOS-QR-Code-Generator code to generate the QR code. now the qr code generated is always n black color.I want to make it in Red or any other color. The coding of coloring And the drawing of QR code .png image is done QR_Draw_png.mm file. What should i edit in QR_Draw_png.mm this file. How to do the generate the colorful qr code.

How is it possible.

Please help me.

回答1:

This is the best example to generate colorful QR code.

http://www.oscarsanderson.com/2013/08/12/implementing-a-qr-code-generator-on-the-iphone/

You will found qrencode library from above link, and Category of UIImage.

After you need to simple call this method with your selected Color to generate it.

mgView.image = [UIImage QRCodeGenerator:txtCouponName.text
                          andLightColour:[UIColor whiteColor]
                           andDarkColour:[UIColor blackColor]
                            andQuietZone:1
                                 andSize:300];


回答2:

You'll have to tinker with the Z-Bar code to do that.

Maybe these links might help:

http://mashable.com/2011/04/18/qr-code-design-tips/

http://qreateandtrack.com/2011/01/06/adding-a-bit-of-color-to-your-qr-codes/

and

http://keremerkan.net/qr-code-and-2d-code-generator/



回答3:

https://chart.googleapis.com/chart?chs=200x200&cht=qr&chl=https://stackoverflow.com/questions/8063575/generate-colorful-qr-code%2F&choe=UTF-8

Use this link same generate web,android,iPhone.



回答4:

     QRCodeWriter writer = new QRCodeWriter();
    try {
        BitMatrix bitMatrix = writer.encode(content, BarcodeFormat.QR_CODE, 512, 512);
        int width = bitMatrix.getWidth();
        int height = bitMatrix.getHeight();
        Bitmap bmp = Bitmap.createBitmap(width, height, Bitmap.Config.RGB_565);
        for (int x = 0; x < width; x++) {
            for (int y = 0; y < height; y++) {
// set colors for QR code
                bmp.setPixel(x, y, bitMatrix.get(x, y) ? Color.BLACK : Color.WHITE);
            }
        }
        ((ImageView) findViewById(R.id.img_result_qr)).setImageBitmap(bmp);

    } catch (WriterException e) {
        e.printStackTrace();
    }