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

Generate QR code with logo #237

Closed
BakytzhanAkzhol opened this issue Jan 30, 2020 · 3 comments
Closed

Generate QR code with logo #237

BakytzhanAkzhol opened this issue Jan 30, 2020 · 3 comments

Comments

@BakytzhanAkzhol
Copy link

BakytzhanAkzhol commented Jan 30, 2020

Hello, I want to generate QR code with logo like this:
Environment: Unity3D C#

I try to write code by examples from Internet.

private Texture2D GenerateBarcode(string data, BarcodeFormat format, int width, int height)
{
        var encodeOptions = new EncodingOptions
        {
            Height = height,
            Width = width,
            Margin = 0,
            PureBarcode = false
        };
        encodeOptions.Hints.Add(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.H);
        
        BarcodeWriter writer = new BarcodeWriter
        {
            Format = BarcodeFormat.QR_CODE,
            Options = encodeOptions
        };
        
        Color32[] pixels = writer.Write(text);
        Texture2D tex = new Texture2D(width, height);
        tex.SetPixels32(pixels);
        tex.Apply();
        return tex;
}

Q1: How i can change fill color the QR code from black color to the green color?
Q2: How i can change "black squares" on the sides of the QR code to another similiar figuare?

Please, help. I have no idea what i need did .

@BakytzhanAkzhol
Copy link
Author

BakytzhanAkzhol commented Jan 30, 2020

Wow, I understand. I can put any picture in center at QR code and it will work. I understod some about QR code. In QR code generation have "QR Code Error Correction Level" , which help read to QR code if we see just 70%. It's mean, I can put any picture 30% on QR code.

@kevin-nick
Copy link

hola saludos, y como realizaste el cambio de color y la forma de los cuadros grndes de las esquinas ??
saludos

@Unity3D-Hardik
Copy link

Is there any example for this ?

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

3 participants