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

Barcodes you can use backgrounds with. #295

Merged
merged 7 commits into from
Aug 5, 2021

Conversation

NigelThorne
Copy link

@NigelThorne NigelThorne commented May 21, 2021

Summary

Generate barcodes that can have background images and custom retackle images in the corners.

Test plan

image
Try it out. :)

Closing issues
closes #294

@NigelThorne
Copy link
Author

ok .. this may be good enough.. tell me what you think .

@NigelThorne
Copy link
Author

We could put back support for the 'overlay image' aswell. I took it out for now.
Also.. we could use the light color as a wash to put over the image... so people can control how much the image gets faded by to allow the black dots to get more contrast.

@codebude
Copy link
Owner

Hi @NigelThorne thanks for your work and the pull request. I'll review within the next days. One thing I already have in mind: Would you mind, if I rename it from "LogoQRCode" to "ArtQRCode"? Background: I think "Logo" may a bit misleading, because users can already place logos on other QRCode rendering classes. Art (or Artistic) would better describe the type of rendering in my opinion.

@NigelThorne
Copy link
Author

sounds good.
I'd like to re-add the logo behaviour on top of the art qr code.

@NigelThorne
Copy link
Author

I've fixed the behaviour so the pixels get cropped to the module square size. This has the side effect that if you set the pixel size large enough you get a standard barcode.

@AlexandreZaytsev
Copy link

AlexandreZaytsev commented Jun 12, 2021

NigelThorne

Hi!
I'm a beginner in C#, want to try your ArtQRCode.cs please tell me how to use it correctly in a demo project (QRCoder/QRCoderDemo/RenderQrCode())(https://github.com/codebude/QRCoder/tree/91839cfe9c445832a61a993893eccfab9e264ee8/QRCoder)?

       private void RenderQrCode()
        {
            string level = comboBoxECC.SelectedItem.ToString();
            QRCodeGenerator.ECCLevel eccLevel = (QRCodeGenerator.ECCLevel)(level == "L" ? 0 : level == "M" ? 1 : level == "Q" ? 2 : 3);
            using (QRCodeGenerator qrGenerator = new QRCodeGenerator())
            using (QRCodeData qrCodeData = qrGenerator.CreateQrCode(textBoxQRCode.Text, eccLevel))

//            using (QRCode qrCode = new QRCode(qrCodeData))
            using (ArtQRCode qrCode = new ArtQRCode(qrCodeData))
            {

//                pictureBoxQRCode.BackgroundImage = qrCode.GetGraphic(20, GetPrimaryColor(), GetBackgroundColor(), GetIconBitmap(), (int)iconSize.Value);
//                pictureBoxQRCode.BackgroundImage = qrCode.GetGraphic(new Bitmap(@"https://i09.fotocdn.net/s110/5ed7884c923c4603/user_l/2448758582.jpg", true));
                  pictureBoxQRCode.BackgroundImage = qrCode.GetGraphic(new Bitmap(@"D:\2448758582.jpg", true));

                this.pictureBoxQRCode.Size = new System.Drawing.Size(pictureBoxQRCode.Width, pictureBoxQRCode.Height);
                //Set the SizeMode to center the image.
                this.pictureBoxQRCode.SizeMode = PictureBoxSizeMode.CenterImage;

                pictureBoxQRCode.SizeMode = PictureBoxSizeMode.StretchImage;
            }

?
but the image is created by squares not dots
tell me - how to do it correctly?
thank you

@AlexandreZaytsev
Copy link

AlexandreZaytsev commented Jun 12, 2021

stop! everything is ok )) (I used the wrong constructor)
but large squares without tails like you have in the picture ))

test

@NigelThorne
Copy link
Author

@AlexandreZaytsev You can pass custom images to use as the corners. They have to be something that would scan though.. :) so they need to have the same 'ring' type structure with the right thickness of black and white. Google use this
image

@NigelThorne
Copy link
Author

@codebude Any plans to merge this :)

@NigelThorne
Copy link
Author

@AlexandreZaytsev If you make the background transparent you can put the background in with a paint package. This lets you cheat and remove dots where faces are etc and still get something that scans (due to the error correcting nature of qr)

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

Successfully merging this pull request may close these issues.

Transparent barcodes
4 participants