How can I convert a qrcode.image.pil.PilImage
to a PIL.Image.Image
?
I am using the qr_code lib in combination with the pillow lib and customtkinter...
I tried to use the generated qr_code image in a CTkImage but I got the error:
ValueError: CTkImage: light_image must be instance if PIL.Image.Image, not <class 'qrcode.image.pil.PilImage'>
You can use .get_image()
to get the internal PIL image:
# assume qrcode_img is of type qrcode.image.pil.PilImage
pil_img = qrcode_img.get_image()
# then pil_img is of type PIL.Image.Image