Cannot decode barcodes which are not padded
I noticed that barcodes which don't have any padding cannot be decoded. I'm using the following code to test:
import sys
from PIL import Image
from pdf417decoder import PDF417Decoder
image = Image.open(sys.argv[1])
decoder = PDF417Decoder(image)
if decoder.decode() > 0:
decoded = decoder.barcode_data_index_to_string(0)
print(decoded)
else:
print("cannot decode")
The following image cannot be decoded:

While the following image can:

Images are the same, except that second image has 1px of white padding around the barcode, while the first image touches the image borders.
Hi Ivan, would you be open to submitting a pull request that adds a 1px border to incoming images to resolve this issue?
We'll merge your PR and can release an update that has that fix incorporated.
I added the padding here : https://github.com/sparkfish/pdf417decoder/pull/7
Looks like the left most of the image need to have single white line , otherwise the start-stop signature won't be detected and hence no barcode will be detected.
This should be closed then right?
This should be closed then right?
It should be resolved, did you facing any problem with it?
I didn't I was just researching and found the open issue, and I think I found a commit or a pull request somewhere that fixes it
On Wed, Dec 6, 2023, 9:50 AM Kok Wei @.***> wrote:
This should be closed then right?
It should be resolved, did you facing any problem with it?
— Reply to this email directly, view it on GitHub https://github.com/sparkfish/pdf417decoder/issues/6#issuecomment-1842274960, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGC6KLMX7KADTWP42BOJLGDYIAPVDAVCNFSM52PCXUP2U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCOBUGIZDONBZGYYA . You are receiving this because you commented.Message ID: @.***>
Yes, this pull request should be merged now: https://github.com/sparkfish/pdf417decoder/pull/7
Yes, this pull request should be merged now: https://github.com/sparkfish/pdf417decoder/pull/7
Awesome, let's close this issue then 🙏