Skip to main content

Python wrapper for ZXing Java library.

Project description

pyzxing

English | 简体中文

GitHub release (latest by date including pre-releases) PyPI Conda-forge Conda

Travis (.org) Codacy grade

First GA

After a year of development, the first General Availability of pyzxing is finally released. I would like to express my gratitude to all the developers for their suggestions and issue, which helped the development of this project to a great extent. This project will continue to be open source and updated regularly.

Introduction

A Python wrapper of ZXing library. python-zxing does not work properly and is out of maintenance. So I decide to create this repository so that Pythoneers can take advantage of ZXing library with minimum effort.

Features

  • Super easy to get hands on decoding qrcode with Python
  • Structured outputs
  • Scan multiple barcodes in one picture
  • Scan multiple pictures in parallel, which speeds up 77%

Installation

Installing from Github source is recommended :

git clone https://github.com/ChenjieXu/pyzxing.git
cd pyzxing
python setup.py install

It is also possible to install from PyPI:

pip install pyzxing

Install from Anaconda. Now available on the public channel, conda-forge:

conda install pyzxing # conda-forge channel
conda install -c chenjiexu pyzxing # private channel

Build ZXing Library

A ready-to-go jar file is available with release, but I can not guarantee that this file will work properly on your PC. You may run test script before building ZXing. Pyzxing will download compiled Jar file automatically and call unit test. For those who haven't installed Java, I strongly recommend you to install openjdk8.

python -m unittest tests.test_decode

If failed, build ZXing using following commands.

git submodule init
git submodule update
cd zxing
mvn install -DskipTests
cd javase
mvn -DskipTests package assembly:single

Quick Start

from pyzxing import BarCodeReader

reader = BarCodeReader()
results = reader.decode('/PATH/TO/FILE')
# Or file pattern for multiple files
results = reader.decode('/PATH/TO/FILES/*.png')
print(results)
# Or a numpy array
# Requires additional installation of opencv
# pip install opencv-python
results = reader.decode_array(img)

Or you may simply call it from command line

python scripts/scanner.py -f /PATH/TO/FILE

TODO

  • Fix setup.py

  • Add multi and pure_barcode into parameters to resolve #25

  • Change Travis CI to GitHub Action

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyzxing-1.1.1.tar.gz (544.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyzxing-1.1.1-py3-none-any.whl (11.5 kB view details)

Uploaded Python 3

File details

Details for the file pyzxing-1.1.1.tar.gz.

File metadata

  • Download URL: pyzxing-1.1.1.tar.gz
  • Upload date:
  • Size: 544.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for pyzxing-1.1.1.tar.gz
Algorithm Hash digest
SHA256 77087602f3ec5ccc3f20619f5f85246e02ff543b81c42c9b24dbc4a9f7f30e5c
MD5 e785d3bb90021b0f0895f9bda062a927
BLAKE2b-256 ccd70e8191aab7a541a7608aff8589a210f025685db36f6b701512ea1f56f82f

See more details on using hashes here.

File details

Details for the file pyzxing-1.1.1-py3-none-any.whl.

File metadata

  • Download URL: pyzxing-1.1.1-py3-none-any.whl
  • Upload date:
  • Size: 11.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for pyzxing-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c589e4d5524f021915aa02fa25c76682bb3ceb9d5121f2e388e71c8faa8f093c
MD5 707853c403bf093f19efa87d074dfec3
BLAKE2b-256 e9f0ed4b248969f3df929375f0a163ed72f0074a926f3955a6e137ee9b5d7241

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page