FriedrichFroebel / brother_ql_web

A Python-based web service to print labels on Brother QL label printers. Based on brother_ql: https://github.com/pklaus/brother_ql
GNU General Public License v3.0
7 stars 4 forks source link

API endpoint to print image #14

Closed FriedrichFroebel closed 2 months ago

FriedrichFroebel commented 6 months ago

Add API endpoint to print an image directly.

tobru commented 5 months ago

That sounds interesting, do you have any plans to do that in the future?

FriedrichFroebel commented 5 months ago

I have no direct plans or schedule for this at the moment, but it shouldn't be too hard to implement as the printing backend is image-based anyway, thus the implementation is an easier variant of the text functionality. Thus I might have a look at this in the near future.

FriedrichFroebel commented 5 months ago

A corresponding endpoint is now available, although not yet released and not available in the GUI. You can call it like this:

import requests

with open("image.png", mode="rb") as fd:
    image_data = fd.read()

response = requests.post(
    url="http://localhost:8013/api/print/image?label_size=62&orientation=standard"
    files={"image": image_data},
)
print(response)
tobru commented 5 months ago

Very cool, thanks a lot! I'll certainly can make use of that.

FriedrichFroebel commented 2 months ago

Version 0.3.0 including this change has just been deployed to PyPI.