mirror of
https://github.com/python-escpos/python-escpos
synced 2025-09-13 09:09:58 +00:00
Merge remote-tracking branch 'origin/master' into merge/upstream/master
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
@author: Manuel F Martinez <manpaz@bashlinux.com>
|
||||
@organization: Bashlinux
|
||||
@copyright: Copyright (c) 2012 Bashlinux
|
||||
@license: GPL
|
||||
@license: GNU GPL v3
|
||||
"""
|
||||
|
||||
try:
|
||||
@@ -111,7 +111,15 @@ class Escpos:
|
||||
def image(self,path_img):
|
||||
""" Open image file """
|
||||
im_open = Image.open(path_img)
|
||||
im = im_open.convert("RGB")
|
||||
|
||||
# Remove the alpha channel on transparent images
|
||||
if im_open.mode == 'RGBA':
|
||||
im_open.load()
|
||||
im = Image.new("RGB", im_open.size, (255, 255, 255))
|
||||
im.paste(im_open, mask=im_open.split()[3])
|
||||
else:
|
||||
im = im_open.convert("RGB")
|
||||
|
||||
# Convert the RGB image in printable image
|
||||
self._convert_image(im)
|
||||
|
||||
@@ -155,6 +163,7 @@ class Escpos:
|
||||
qr_code.make(fit=True)
|
||||
qr_img = qr_code.make_image()
|
||||
im = qr_img._img.convert("RGB")
|
||||
|
||||
# Convert the RGB image in printable image
|
||||
self._convert_image(im)
|
||||
|
||||
|
Reference in New Issue
Block a user