Created
February 12, 2015 00:16
-
-
Save benhosmer/4d2c1875d8257b78c972 to your computer and use it in GitHub Desktop.
Python using elaphe to generate UPC A Barcodes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/usr/bin/env python | |
# Install elaphe first | |
# pip install elaphe | |
from elaphe.upc import UpcA | |
upc_a = UpcA() | |
# Just a simple dictionary of numbers. If I remember right, I had to use UPC A because they had the number of characters I needed | |
# to correlate with the user id. | |
# You could easily read this from an exported file too. | |
codes = ['00000000001', '00000000002', '00000000003'] | |
for x in codes: | |
upca_image = upc_a.render(x, options=dict(includetext=True), scale=3, margin=1) | |
upca_image.save(x + '.png') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment