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.5.tar.gz (211.7 kB view details)

Uploaded Source

Built Distribution

pybarcodes-0.7.5-py3-none-any.whl (210.7 kB view details)

Uploaded Python 3

File details

Details for the file pybarcodes-0.7.5.tar.gz.

File metadata

  • Download URL: pybarcodes-0.7.5.tar.gz
  • Upload date:
  • Size: 211.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.9.19

File hashes

Hashes for pybarcodes-0.7.5.tar.gz
Algorithm Hash digest
SHA256 398aaeda28a26af85357ff8d4fcd91368f5880e974d3107cc99272056a618244
MD5 c45d9e218b0b389df23d219c8f5c49e5
BLAKE2b-256 af99c4482d5911083803625324d5b4ebabd8de5d6053d4fae1fce05604238ea1

See more details on using hashes here.

File details

Details for the file pybarcodes-0.7.5-py3-none-any.whl.

File metadata

  • Download URL: pybarcodes-0.7.5-py3-none-any.whl
  • Upload date:
  • Size: 210.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.9.19

File hashes

Hashes for pybarcodes-0.7.5-py3-none-any.whl
Algorithm Hash digest
SHA256 817bd496497b4e84a241b2523a9f1dd6687d88af3b68cc069af6aad92048c83a
MD5 9b0e9838d2b803ad172b53d0bd43dc88
BLAKE2b-256 2dd22d173c845692e3268aa134a4db705e2facd8d12715c270d3c61c0d00dd10

See more details on using hashes here.

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