from barcode import EAN13 from barcode.writer import ImageWriter number="5901245126645" //data that you want to store a=EAN13(number,writer=ImageWriter()) a.save("barcodeimage") //name of the barcode photo