How to print a PNG image.

// Expert user has replied.
M Michael Usry 1 year 1 month ago
1416 4 0

We have a customer sending us a PNG file in Base64.  This image is the entire label.  I need to print it with ZPL on a ZE5x1 printer.  I'm new at this and need help with this.  Has anyone done this and can help?

Please Register or Login to post a reply

4 Replies

M Michael Usry

This is the code I'm trying to use to print this test barcode

test barcode

 

^XA
~DYe:barcode,p,p,2216,2216,iVBORw0KGgoAAAANSUhEUgAAAyAAAAEsCAAAAAAeRojmAAAAAXNCSVQI5gpbmQAABjdJREFUeJzt3N1y4jYAgFG70/d/ZfWiIdiy/EHSn92ZnHOxCdhIZqsPDN7pPjbgzh+/+gDgdyYQCAKBIBAIAoEgEAgCgSAQCAKBIBAIAoEgEAgCgSAQCAKBIBAIAoEgEAgCgSAQCAKBIBAIAoEgEAgCgSAQCAKBIBAIAoEgEAgCgSAQCAKBIBAIf/6SWfdt27ZtbNu+beNxzzjvMA57bueb43z/ftjh87H7zW7XR11/OR7kdjnC6eCXw07PbvmUt5tnsa+eSzyLu8Obptju/4qmSadBvvT3tnz61/9qMcJykGmH/5F3EAgCgSAQCAKBIBAIAoEgEAgCgSAQCAKBIBAIAoEgEAgCgSAQCAKBIBAIAoEgEAgCgSAQCAKBIBAIAoEgEAgCgSAQCAKBIBAIAoEgEAgCgSAQCAKBIBAIAoEgEAgCgSAQCAKBIBAIAoEgEAgCgSAQCAKBIBAIAoEgEAgCgSAQCAKBIBAIAoEgEAgCgSAQCAKBIBAIAoEgEAgCgSAQCAKBIBAIAoEgEAgCgSAQCAKBIBAIAoEgEAgCgSAQCAKBIBAIAoEgEAgCgSAQCAKBIBAIAoEgEAgCgSAQCAKBIBAIAoEgEAgCgSAQCAKBIBAIAoEgEAgCgSAQCAKBIBAIAoEgEAgCgSAQCAKBIBAIAoEgEAgCgSAQCAKBIBAIAoEgEAgCgSAQCAKBIBAIAoEgEAgCgSAQCAKBIBAIAoEgEAgCgSAQCAKBIBAIAoEgEAgCgSAQCAKBIBAIAoEgEAgCgSAQCAKB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R8v+OfuZ491Na266RLH9MHh/srEtPVw9e+6eueRpuMY1xIW//BlfiKrDzifs8eTFMoHp1hfNeLWfOdXVtn6kmQO9YV5rPdvcor1ls+X13G+42bdjdq4HnocbxzX/r8xjzy+zSkWBKdYEAQCQSAQBAJBIBAEAkEgEAQCQSAQBAJBIBAEAkEgEAQCQSAQBAJBIBAEAkEgEAQCQSAQBAJBIBAEAkEgEAQCQSAQBAJBIBAEAkEgEAQCQSAQBAJBIBAEAkEgEP4C+s1CgOrS/icAAAAASUVORK5CYII=


^FO0,0^IME:barcode.png
^FS
^XZ
 

S Steven Si

You can use the Link-OS® Multiplatform SDK to connect to the ZE5x1 printer, then call the GraphicUtil.printImage() API to print the PNG on the label.

V Veronica Klein

I cannot use the Geometry Lite Link-OS® Multiplatform SDK to connect to the ZE5x1. Can you provide detailed instructions?

W Winfield Johns

Example using pillow and zplgrf (a Python library for converting images to ZPL):

from PIL import Image
import zplgrf

# Open the image
image = Image.open("label.png")

# Convert to monochrome (1-bit pixels, black and white)
image = image.convert("1")

# Generate ZPL
zpl = zplgrf.image_to_zpl(image)

# Save ZPL to a file or send it directly to the printer
with open("label.zpl", "w") as file:
   file.write(zpl)
 

CONTACT
Can’t find what you’re looking for?