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

Is it possible to round the corners of the alignment sqaures #332

Open
macmichael01 opened this issue May 21, 2023 · 1 comment
Open

Is it possible to round the corners of the alignment sqaures #332

macmichael01 opened this issue May 21, 2023 · 1 comment

Comments

@macmichael01
Copy link

I generated a qrcode using the RoundedModuleDrawer() but it does not round the alignment squares. Is it possible with this library?

Here is what I am hoping to achieve:
Screenshot 2023-05-20 at 1 40 18 AM

@Vill21
Copy link

Vill21 commented Aug 4, 2023

Yes it is possible, though I don't know if there is a way to make blocks more or less round. I've found solution in #329. A QRCode object has a method make_image. There you may pass an argument eye_drawer the same way as module_drawer. I will explain here, how I understand the meaning of each argument. The first one affects alignment blocks while the second one takes control under the other data carrying blocks of a QR code. The example code is provided below.

image = qr.make_image(fill_color="black",
                          back_color="white",
                          image_factory=StyledPilImage,
                          module_drawer=module_drawer(),
                          eye_drawer=module_drawer())

module_drawer here is one of the classes of module drawers. To style a QR code I use StyledPilImage factory with PIL module drawers from qrcode.image.styles.moduledrawers.pil.

This method does not allow to get pictures with alignment blocks to be styled in a way you might expect or so that it can be then successfully scanned. See #329 for an example. And here is what I have after using this method.

qrcode_0

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