NaturalHistoryMuseum / pyzbar

Read one-dimensional barcodes and QR codes from Python 2 and 3.
MIT License
718 stars 175 forks source link

Why do I only get part of the UPC? #141

Open selected-pixel-jameson opened 1 year ago

selected-pixel-jameson commented 1 year ago

I'm trying to read the UPC Code from this image via the following code.

img = Image.open(requests.get(url, stream=True).raw)
results = decode(img)

https://previewsworld.com/SiteImage/MainImage/STL241987.jpg

And it returns the following.

[[
        [
            "0759606204007",
            "EAN13",
            [
                613,
                1956,
                201,
                69
            ],
            [
                [
                    613,
                    1957
                ],
                [
                    613,
                    2025
                ],
                [
                    710,
                    2025
                ],
                [
                    813,
                    2024
                ],
                [
                    814,
                    1958
                ],
                [
                    814,
                    1956
                ]
            ],
            139,
            "UP"
        ]
    ]]

This is the correct code. But it's missing the 00241 located in the secondary bar code and doesn't return that value either. Am I doing something wrong? Sorry, I'm new to working with barcodes so I might be missing something here.

selected-pixel-jameson commented 1 year ago

Investigating this further the second bar code in the referenced image is referred to as a supplemental barcode that can be associated with a UPC-A format.