A simple zbar wrapper
Project description
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())
Project details
Release history Release notifications | RSS feed
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.0.tar.gz
(8.9 kB
view details)
File details
Details for the file zbarlight-0.1.0.tar.gz
.
File metadata
- Download URL: zbarlight-0.1.0.tar.gz
- Upload date:
- Size: 8.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a8e111c2a6068a071409cf70029bc0bcec4e7e2d3ade927b31402045af57f37c |
|
MD5 | 825c79c7e9ed61b7af2ca28f91f74f3c |
|
BLAKE2b-256 | a392743e2aafa1b025a1f65d74411be617e900a45e3ba6962e43565c8ab08d15 |