import barcode
from barcode.writer import ImageWriter
import os
from PIL import Image
def barcode_to_png(barcode_type,text_str,filename):
EAN = barcode.get_barcode_class(barcode_type) #设置生成一维码的类型
ean = EAN(text_str, writer=ImageWriter())
ean.save(filename)
#条码类型code128,转换内容123456,文件名称name.png
barcode_to_png('code128','123456',"name")
python字符转换条码
最新推荐文章于 2024-07-16 10:57:23 发布