-
Notifications
You must be signed in to change notification settings - Fork 6
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
image stretching when I generate a qr code #6
Comments
Hi, I tested your code and got the same result. A simple fix is to call image = qr.make_image(fill_color="red", back_color="white")
data = list(image.get_image().getdata())
with RaspberryPi() as rpi:
display = Display(rpi)
display.initialize(rotation=90) # this is needed for your display, I think
display.set_bounds(0, 0, image.size[0], image.size[1]) # restrict the draw region to the image size
display.draw_rgb_bytes(data) This will correctly draw the QR code in the top-left corner. I also tried this: display.set_bounds((display.base_width - image.size[0]) // 2,
(display.base_height - image.size[1]) // 2,
(display.base_width + img.size[0]) // 2,
(display.base_height + img.size[1]) // 2) |
THANK YOU SO MUCH!!! I really appreciate your fast response! I have been trying to get this to work for weeks. I am so new to this sort of thing and I tried really hard to search online, but I was getting no results. Thank you once again!!! :) |
Ah, an interesting issue - there's a logic bug when using Try the centering code with the original 198x198 size, but using |
Thank you so much, that fixed it! :) |
Using the examples from this library, I have been trying to generate qr codes to display on this tft. However, the image is stretched and doesn't end up working. However, when I pass images I donwload online, they work just fine.
Here's the test code I used:
st7789v-qr-gen-test.txt
The result:
The text was updated successfully, but these errors were encountered: