Skip to content

Conversation

@NaziaAfreen015
Copy link

While pyzbar.decode converts PIL image into greyscale or enforces greyscale image for a (pixel, width, height) argument; it currently grabs only the first channel from NumPy arrays. That works for grayscale/standard RGB, but fails when the QR foreground/background is carried in non-first channels (e.g., red-only scenes). Since libzbar already provides reliable color→8bpp conversion, this PR routes array inputs through zbar’s converters to ensure correct decoding regardless of which channel holds the signal.

Add thin wrappers for zbar_image_convert, zbar_image_convert_resize, zbar_image_get_data, and zbar_image_get_data_length.

When a NumPy array with 3/4 channels is passed, convert to 8bpp via libzbar before scanning.

Preserve existing grayscale path; no behavior change for 8bpp inputs.

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