草庐IT

pyBarcode

全部标签

python - 将 pyBarcode 输出转换为 PIL 图像文件

我试图在不先保存图像的情况下将pyBarcode的输出转换为PIL图像文件。首先,pyBarcode生成一个像这样的图像文件:>>>importbarcode>>>frombarcode.writerimportImageWriter>>>ean=barcode.get_barcode('ean','123456789102',writer=ImageWriter())>>>filename=ean.save('ean13')>>>filenameu'ean13.png'正如您在上面看到的,我不希望将图像实际保存在我的文件系统中,因为我希望将输出处理成PIL图像。所以我做了一些修改:i