Skip to main content

A Python barcode generator

Project description

Documentation Status PyPI version info 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.6.0 or higher is required

To install the library you can run the following command:

# Linux/MacOS
python3 -m pip install --upgrade pybarcodes

# Windows
py -3 -m pip install --upgrade pybarcodes

Quick Example

You can see what barcodes are supported

>>> import pybarcodes
>>> pybarcodes.SUPPORTED_BARCODES
['EAN13', 'EAN8', 'EAN14', 'JAN', 'CODE39']

And you can use this to view the barcode that was generated:

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.

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 of Barcode

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

pybarcodes-0.7.2.tar.gz (10.5 kB view hashes)

Uploaded Source

Built Distribution

pybarcodes-0.7.2-py3-none-any.whl (14.2 kB view hashes)

Uploaded Python 3

Supported by

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