https://github.com/atbuy/pybarcodes
A library to read and write barcodes and QR codes
https://github.com/atbuy/pybarcodes
barcode barcode-reader barcode-scanner barcodes python python3 qrcode qrcode-generator qrcode-reader qrcode-scanner
Last synced: 10 days ago
JSON representation
A library to read and write barcodes and QR codes
- Host: GitHub
- URL: https://github.com/atbuy/pybarcodes
- Owner: atbuy
- License: mit
- Created: 2021-05-14T03:16:41.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2025-02-08T18:00:18.000Z (about 1 year ago)
- Last Synced: 2025-08-23T05:38:27.805Z (6 months ago)
- Topics: barcode, barcode-reader, barcode-scanner, barcodes, python, python3, qrcode, qrcode-generator, qrcode-reader, qrcode-scanner
- Language: Python
- Homepage: https://pybarcodes.readthedocs.io/
- Size: 6.05 MB
- Stars: 5
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.rst
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
pybarcodes
==========
.. image:: https://readthedocs.org/projects/pybarcodes/badge/?version=latest
:target: https://pybarcodes.readthedocs.io/en/latest/?badge=latest
:alt: Documentation Status
.. image:: https://img.shields.io/pypi/v/pybarcodes.svg
:target: https://pypi.python.org/pypi/pybarcodes
:alt: PyPI version info
.. image:: https://img.shields.io/pypi/pyversions/pybarcodes.svg
:target: https://pypi.python.org/pypi/pybarcodes
:alt: PyPI supported Python versions
This is a python package to create and read barcodes
You can create file-like objects, text files and images from just a barcode number.
Image generation is fast so it can be used to create images in bulk.
Supported Barcode Types
------------------------
- EAN13
- EAN8
- EAN14
- JAN
- CODE39
More types will soon be supported.
PRs are welcome :)
Installing
-----------
**Python 3.9 or higher is required**
To install the library you can run the following command:
.. code:: bash
pip install pybarcodes
Quick Example
--------------
You can see what barcodes are supported
.. code:: py
>>> import pybarcodes
>>> pybarcodes.SUPPORTED_BARCODES
['EAN13', 'EAN8', 'EAN14', 'JAN', 'CODE39']
And you can use this to view the barcode that was generated:
.. code:: py
from pybarcodes import EAN13
CODE = "012345678905"
barcode = EAN13(CODE)
barcode.show()
This is pretty much all the code you need to generate a barcode.
Saving an image of the barcode is pretty straightforward.
.. code:: py
from pybarcodes import EAN14
barcode = EAN14("40700719670720")
# Saves the image in PNG format
barcode.save("myimage.png")
# You can also resize it.
barcode.save("myimage2.png", size=(100000, 1000000))
EAN13 output from example 2:
.. image:: https://i.imgur.com/wd7jyIx.png
:target: https://i.imgur.com/wd7jyIx.png
:alt: Image of Barcode
Links
------
- `Documentation `_
- `PyPi `_