Quick Barcodes

FREEMIUM
By Quick Dev | Updated a month ago | Business
Health Check

N/A

Back to All Tutorials (2)

Saving the barcode to file in Python

from io import BytesIO
import base64

Assuming you have received the HTTP response successfully

barcode64Str = request["barcode"]
barcode64 = barcode64Str[22:]       # Remove the first 22 characters, to remove "image/png;base64," which leaves only the Base64 value.
barcodeBin = base64.b64decode(barcode64)
with open("barcode.png", "wb") as f:
    f.write(barcodeBin)