Skip to content

PIL input handling in qreader/qrdet#53

Open
NaziaAfreen015 wants to merge 1 commit intoEric-Canas:mainfrom
NaziaAfreen015:main
Open

PIL input handling in qreader/qrdet#53
NaziaAfreen015 wants to merge 1 commit intoEric-Canas:mainfrom
NaziaAfreen015:main

Conversation

@NaziaAfreen015
Copy link

qreader.detect_and_decode forwards PIL images to qrdet, which supports PIL for detection but not for crop_qr (expects NumPy). This mismatch breaks decoding when a PIL image is passed. Additionally, qrdet’s type check accepts PIL.ImageFile subclasses but not generic PIL.Image.Image (e.g., after Image.open(...).convert('RGB')), so valid PIL images are rejected.

  • Always convert PIL inputs to NumPy arrays in qreader.detect_and_decode before calling crop_qr.

  • Relax/normalize image-type checks in qrdet to accept generic PIL.Image.Image (not only PIL.*ImageFile subclasses).
    Aligns qrdet behavior so that both Image.open(path) and Image.open(path).convert('RGB') are accepted.

@NaziaAfreen015 NaziaAfreen015 changed the title convert any image to numpy image due to image type match misconfigura… PIL input handling in qreader/qrdet Oct 16, 2025
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.

1 participant