Quick Barcodes

FREEMIUM
Par Quick Dev | Mise à jour 2ヶ月前 | Business
Health Check

N/A

Retour à tous les tutoriels (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)