7

I've looked everywhere and I've only found information related to generating PDF417 codes, but nothing regarding how to decode them. Is there a library to decode them in python? I'm already detecting the code in an image and croping it, but now I need a decoder.

Christian Rodriguez
  • 630
  • 1
  • 8
  • 24
  • I don't think there is anything decent in python / yet but https://www.silverbaytech.com/files/pdf417/pdf_api.pdf is a good starting point and the GPL2 C code at https://github.com/estebandelaf/pdf417decode looks promising – jtlz2 Sep 28 '18 at 09:07

2 Answers2

4

I found this little piece of code, which does just what I want. It decodes PDF417 barcodes. Doesn't seem to be that robust though, so I'll guess I'll have to give the images some strong processing to extract only the barcode.

Christian Rodriguez
  • 630
  • 1
  • 8
  • 24
2

There are two libraries that I know of for decoding PDF417 barcodes.

You can checkout python-zxing which is a python wrapper for the ZXing decoder or you can use pdf417decoder which is a native Python port of a C# PDF417 decoder library.

ZXing requires files to be saved to the disk first while pdf417decoder can take a PIL Image object directly.

Brett Allen
  • 5,297
  • 5
  • 32
  • 62