Menu
Barcode Generator
Make Barcode using Python
- We can generate barcodes very easily using the python-barcode
library.
Install the Required Package
pip install python-barcode
Using ean13
Class
This creates a barcode in SVG format. Write and run this code inside a directory:
import barcode
bar = barcode.get_barcode_class("ean13")
Bar = bar("1234567890128")
Bar.save("make-barcode")
After running, it will generate a make-barcode.svg file.
make-barcode.svg
Scan this to get the encoded data.
Using code39
Class
This creates a barcode in PNG format. Run this code inside a directory:
import barcode
from barcode.writer import ImageWriter
bar = barcode.get_barcode_class("code39")
Bar = bar("1234567890128", writer=ImageWriter())
Bar.save("make-barcodes")
After running, it will generate a make-barcodes.png file.
make-barcodes.png
Scan this to get the encoded data.
No comments yet. Be the first to comment!