from PIL import Image
import qrcode
# Load the uploaded image
image_path = "/mnt/data/1000006209.jpg"
img = Image.open(image_path)
# Create a QR code that embeds the image itself (as a data URI)
# Since QR codes are meant for short text/data, embedding a full image is not practical.
# Instead, we will generate a QR code that links to a placeholder where the image could be accessed.
# For demonstration, we will simulate a URL (e.g., to where this image would be hosted)
# You would replace this with the actual URL where the image is uploaded
simulated_url = "https://example.com/uploads/1000006209.jpg"
# Generate the QR code
qr = qrcode.QRCode(version=1, box_size=10, border=5)
qr.add_data(simulated_url)
qr.make(fit=True)
qr_img = qr.make_image(fill="black", back_color="white")
# Save QR code image to view
qr_image_path = "/mnt/data/qr_code_image.png"
qr_img.save(qr_image_path)
qr_image_path