How to Create a barcode in python

How to Create a barcode in python | Python Projects

How to create a barcode in python

In this projects we are going to create a barcode with the help of python.

You can also see How to Convert PDF files to Doc file,   How to create URL Shortner with Python .

You can use python-barcode to generate different types of objects. First install the barcode:

pip install python-barcode

Below, we are going to create an ISBN13 barcode. Please note that this module supports many other types of barcodes. We are going to generate a PNG image of the barcode. We will use the pillow module to view the image. You can install pillows by running:

pip install pillow

Pass a 12-digit number as a string.

from barcode import ISBN13
from barcode.writer import ImageWriter
from PIL import Image
num = '979117528719'
# saving image as png
bar_code = ISBN13(num, writer=ImageWriter())
# save image'bar_code')
#read the image using pillow
img ="bar_code.png")



Some of best courses recommended by us to boost your career ...

Shell Scripting course

Recon Course

Spread the love

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top