• Stars
    star
    163
  • Rank 231,141 (Top 5 %)
  • Language
    Python
  • License
    BSD 3-Clause "New...
  • Created almost 10 years ago
  • Updated 6 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A simple wrapper for zbar

ZbarLight

zbarlight is a simple wrapper for the zbar library. For now, it can read all zbar supported codes. Contributions, suggestions and pull requests are welcome.

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 before installing zbarlight.

On Debian

$ apt-get install libzbar0 libzbar-dev
$ pip install zbarlight  # you can also use setuptools directly

On Mac OS X

$ brew install zbar
$ export LDFLAGS="-L$(brew --prefix zbar)/lib"
$ export CFLAGS="-I$(brew --prefix zbar)/include"
$ pip install zbarlight

On Windows

Instruction can be found on <https://gist.github.com/Zephor5/aea563808d80f488310869b69661f330>.

How To use ZbarLight

from PIL import Image
import zbarlight

file_path = './tests/fixtures/two_qr_codes.png'
with open(file_path, 'rb') as image_file:
    image = Image.open(image_file)
    image.load()

codes = zbarlight.scan_codes(['qrcode'], image)
print('QR codes: %s' % codes)

Troubleshooting

In some case zbarlight will not be able to detect the 1D or 2D code in an image, one of the known cause is that the image background color is the same as the foreground color after conversion to grey scale (it's happen on images with alpha channel). You can use the copy_image_on_background function to add a background color on your image.

from PIL import Image
import zbarlight

file_path = './tests/fixtures/two_qr_codes.png'
with open(file_path, 'rb') as image_file:
    image = Image.open(image_file)
    image.load()

new_image = zbarlight.copy_image_on_background(image, color=zbarlight.WHITE)  # <<<<<<<<<<<<<<<< Add this line <<<<
codes = zbarlight.scan_codes(['qrcode'], new_image)
print('QR codes: %s' % codes)

Some other cases without known solutions are show in the scan_codes() tests (search for the expected failures). Any clues on these cases is welcome.

More Repositories

1

vue-gettext

Translate your Vue.js applications with gettext.
JavaScript
278
star
2

aioamqp

AMQP implementation using asyncio
Python
273
star
3

easygettext

Simple gettext tokens extraction tools for HTML and Jade files.
JavaScript
79
star
4

libcanardbc

Library to read DBC files of CAN bus networks
Yacc
74
star
5

django-cid

Correlation Id for Django
Python
36
star
6

systematic

An opinionated ES6 toolchain for the browser.
JavaScript
25
star
7

xlsx_streaming

Stream data as xlsx
Python
22
star
8

caneton

Offspring of libcanardbc to decode CAN messages from Python code or CLI
Python
20
star
9

getconf

Simple Python configuration utilities.
Python
18
star
10

django-mds

Python
15
star
11

sentry-sourcemaps

Seamlessly upload your source maps to Sentry; comes with a CLI interface.
JavaScript
15
star
12

grocker

Grocker, docker image builder
Python
11
star
13

wireshark-canvas

This repository is intended to help using the CANvas plugin for Wireshark on Linux.
Shell
11
star
14

react-bubble

A simple and customizable bubble for react
JavaScript
9
star
15

django-select2-rocks

Yet another integration glue between Django and Select2 JS
JavaScript
9
star
16

flow-inlinestyle

JavaScript
5
star
17

pyhound

A command-line client for the Hound source code search engine.
Python
5
star
18

dokang

Lightweight web document repository with a search engine
Python
5
star
19

react-doks

React static documentation generator, aimed at merging the development and the documentation workflow
JavaScript
5
star
20

check-oldies

The developer companion that warns about unattended FIXME and TODO annotations
Python
4
star
21

docker-registry-purger

A simple cleaner for private docker-registries
Python
4
star
22

bluepicker

Vanilla date, time, and range picker with ergonomic input
JavaScript
4
star
23

try-hard

tryHard is a convenient tool when writing your Javascript tests and you need to test asynchronous state changes with no control on the timing
JavaScript
3
star
24

ansibilo

Set of tools for Ansible
Python
3
star
25

devpi-remote_user

Python
2
star
26

react-hooks-by-example

TypeScript
2
star
27

papaya

LDAP-backed Django authentication module, including openid.
Python
2
star
28

sphinx-dust

Sphinx extension to help keep docs up-to-date
Python
1
star
29

bizdatim

Library for business hour arithmetic. Fork from https://bitbucket.org/shelldweller/python-bizdatetime.
Python
1
star
30

k8s-proxy-image-swapper

Go
1
star
31

mds-agency-validator

HTTP validator for MDS Agency API
Python
1
star
32

curtis

A simple sentry cli
Python
1
star
33

pylint-strict-informational

Python
1
star
34

cogite

A command line GitHub/GitLab helper for your pull requests
Python
1
star
35

redux-waitfor-middleware

JavaScript
1
star
36

granadilla

LDAP management tools
Python
1
star
37

karma-webpack-errors-reporter

WIP: A better Webpack error reporting plugin.
JavaScript
1
star
38

eslint-plugin-typeorm

JavaScript
1
star