Merge pull request #3009 from initOS/8.0-fix_escpos_with_non_rgba_image
Bug: Exception when printing POS receipt via hardware proxy
This commit is contained in:
commit
02bdbee088
|
@ -442,7 +442,12 @@ class Escpos:
|
|||
f.seek(0)
|
||||
img_rgba = Image.open(f)
|
||||
img = Image.new('RGB', img_rgba.size, (255,255,255))
|
||||
img.paste(img_rgba, mask=img_rgba.split()[3])
|
||||
channels = img_rgba.split()
|
||||
if len(channels) > 1:
|
||||
# use alpha channel as mask
|
||||
img.paste(img_rgba, mask=channels[3])
|
||||
else:
|
||||
img.paste(img_rgba)
|
||||
|
||||
print 'convert image'
|
||||
|
||||
|
|
Loading…
Reference in New Issue