Skip to content

Commit

Permalink
use latest ZXing release (3.5.1) and JCommander release (1.82)
Browse files Browse the repository at this point in the history
Release 3.5.0 finally includes all of the improvements that I contributed in
2020 🙌

- zxing/zxing#1333 (decode PDF417 barcodes rotated 90° or 270°)
- zxing/zxing#1330 (Aztec encoding of non-default charsets)
- zxing/zxing#1328 (Aztec decoding of non-default charsets)

  Added a test image to verify this.
  • Loading branch information
dlenski committed Apr 14, 2023
1 parent f2e5cbc commit cb46c29
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ It will allow you to read and decode barcode images from Python.
Use the Python 3 version of pip (usually invoked via `pip3`) to install: `pip3 install zxing`

* You'll neeed to have a recent `java` binary somewhere in your path. (Tested with OpenJDK v7, v8, v11.)
* pip will automatically download the relevant [JAR](https://en.wikipedia.org/wiki/JAR_(file_format)) files for the Java ZXing libraries (currently v3.4.1)
* pip will automatically download the relevant [JAR](https://en.wikipedia.org/wiki/JAR_(file_format)) files for the Java ZXing libraries (currently v3.5.1)

## Usage

Expand All @@ -22,7 +22,7 @@ The `BarCodeReader` class is used to decode images:
>>> import zxing
>>> reader = zxing.BarCodeReader()
>>> print(reader.zxing_version, reader.zxing_version_info)
3.4.1 (3, 4, 1)
3.5.1 (3, 5, 1)
>>> barcode = reader.decode("test/barcodes/QR_CODE-easy.png")
>>> print(barcode)
BarCode(raw='This should be QR_CODE', parsed='This should be QR_CODE', path='test/barcodes/QR_CODE-easy.png', format='QR_CODE', type='TEXT', points=[(15.0, 87.0), (15.0, 15.0), (87.0, 15.0), (75.0, 75.0)])
Expand Down
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@


def download_java_files(force=False):
files = {'java/javase.jar': 'https://repo1.maven.org/maven2/com/google/zxing/javase/3.4.1/javase-3.4.1.jar',
'java/core.jar': 'https://repo1.maven.org/maven2/com/google/zxing/core/3.4.1/core-3.4.1.jar',
'java/jcommander.jar': 'https://repo1.maven.org/maven2/com/beust/jcommander/1.78/jcommander-1.78.jar'}
files = {'java/javase.jar': 'https://repo1.maven.org/maven2/com/google/zxing/javase/3.5.1/javase-3.5.1.jar',
'java/core.jar': 'https://repo1.maven.org/maven2/com/google/zxing/core/3.5.1/core-3.5.1.jar',
'java/jcommander.jar': 'https://repo1.maven.org/maven2/com/beust/jcommander/1.82/jcommander-1.82.jar'}

for fn, url in files.items():
p = path.join(path.dirname(__file__), 'zxing', fn)
Expand Down
Binary file added test/barcodes/AZTEC-utf8.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions test/test_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
('CODE_128-easy.jpg', 'CODE_128', 'This should be CODE_128'),
('PDF_417-easy.bmp', 'PDF_417', 'This should be PDF_417'),
('AZTEC-easy.jpg', 'AZTEC', 'This should be AZTEC'),
('AZTEC-utf8.png', 'AZTEC', 'L’état, c’est moi'),
('QR CODE (¡filenáme törture test! 😉).png', 'QR_CODE', 'This should be QR_CODE'),
('QR_CODE-png-but-wrong-extension.bmp', 'QR_CODE', 'This should be QR_CODE'),
('QR_CODE-fun-with-whitespace.png', 'QR_CODE', '\n\r\t\r\r\r\n '),
Expand Down

0 comments on commit cb46c29

Please sign in to comment.