Skip to content

Printing images is excruciatingly slow #4

@borfast

Description

@borfast

I'm trying to use escposprinter in a RaspberryPi 3 with the very latest Raspbian (released just a few days ago) and an Epson TM-T20 II printer.

Printing text works just fine and is quite fast but printing an image is excruciatingly slow.

This is for a ticketing system, so what I'm doing is using PIL to load a white image (previously created with the right dimensions for the purpose: 400x210), drawing the text over the image and saving it to a temporary file. Then I call Escpos.image() and pass it the path to the temporary image. I'm attaching an example here.
number_temp

It works and the image gets printed but very, very slowly.

When the printer finishes, it seems like the image was divided in rows and each row was printed individually. You can even hear the printer printing each individual row and see the thin blank lines between each filled/drawn row.

Any clue as to why this may be happening and how to fix it?

Here's the code I'm using:

def printQueue(queue_number, queue_line):
    # Base white image where text is to be printed
    img = Image.open(original_img)
    draw = ImageDraw.Draw(img)
    font = ImageFont.truetype("/usr/share/fonts/truetype/roboto/RobotoCondensed-Bold.ttf", 110)
    queue_text = queue_line + ' ' + queue_number
    draw.text((190, 0), queue_text, (0, 0, 0), font=font)
    img.save(temp_img)

    with EscposIO(printer.Usb(0x04b8, 0x0e15)) as p:
        p.printer.image(temp_img)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions