Skip to main content

ZbarLight

zbarlight is a simple wrapper for the zbar library. For now, it only allows to read QR codes but contributions, suggestions and pull requests are welcome.

zbarlight is compatible with Python 2 and Python 3.

zbarlight is hosted on Github at <https://github.com/Polyconseil/zbarlight/>.

Installation

You need to install ZBar Bar Code Reader <http://zbar.sourceforge.net/> and its headers to use zbarlight:

  • on Debian, apt-get install libzbar0 libzbar-dev

  • on Mac OS X, brew install zbar

Then you should use pip or setuptools to install the zbarlight wrapper.

How To use ZbarLight

from PIL import Image
import zbarlight

file_path = './tests/fixtures/one_qr_code.png'
with open(file_path, 'rb') as image_file:
    image = Image.open(image_file)
    image.load()
converted_image = image.convert('L')  # Convert image to gray scale (8 bits per pixel).
image.close()

raw = converted_image.tobytes()  # Get image data.
width, height = converted_image.size  # Get image size.
code = zbarlight.qr_code_scanner(raw, width, height)

print('QR code: %s' % code.decode())

Download files

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

Source Distribution

zbarlight-0.1.1.tar.gz (8.9 kB view details)

Uploaded Source

File details

Details for the file zbarlight-0.1.1.tar.gz.

File metadata

  • Download URL: zbarlight-0.1.1.tar.gz
  • Upload date:
  • Size: 8.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for zbarlight-0.1.1.tar.gz
Algorithm Hash digest
SHA256 80a419aa53925e89d082f49952ab8b75038b46b931f86826a21d28687aa94ec7
MD5 5bc8147eb6464041d82589e37f02b38e
BLAKE2b-256 5821af35efb01959ce9be2a6c14e25260530657456b3e914fbc8bf0c16d79c2d

See more details on using hashes here.

Release history Release notifications | RSS feed

4.0

1 file

3.0

1 file

2.3

1 file

2.2

1 file

2.1

1 file

2.0

1 file

1.2

1 file

1.1.0

1 file

1.0.2

1 file

1.0.1

1 file

1.0.0

1 file

This release

0.1.1 This release

1 file

0.1.0

1 file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page