FIX fullimage so that it at least creates output

This commit is contained in:
Patrick Kanzler 2016-03-03 21:43:12 +01:00
parent 5b5c2c0dba
commit 4c406c1775
1 changed files with 6 additions and 6 deletions

View File

@ -16,10 +16,7 @@ from __future__ import unicode_literals
import six import six
try: from PIL import Image
import Image
except ImportError:
from PIL import Image
import qrcode import qrcode
import textwrap import textwrap
@ -160,7 +157,10 @@ class Escpos(object):
:param path_img: complete filename and path to image of type `jpg`, `gif`, `png` or `bmp` :param path_img: complete filename and path to image of type `jpg`, `gif`, `png` or `bmp`
""" """
if not isinstance(path_img, Image.Image):
im_open = Image.open(path_img) im_open = Image.open(path_img)
else:
im_open = path_img
# Remove the alpha channel on transparent images # Remove the alpha channel on transparent images
if im_open.mode == 'RGBA': if im_open.mode == 'RGBA':
@ -179,7 +179,7 @@ class Escpos(object):
.. todo:: Seems to be broken. Write test that simply executes function with a dummy printer in order to .. todo:: Seems to be broken. Write test that simply executes function with a dummy printer in order to
check for bugs like these in the future. check for bugs like these in the future.
""" """
if isinstance(img, (Image, Image.Image)): if isinstance(img, Image.Image):
im = img.convert("RGB") im = img.convert("RGB")
else: else:
im = Image.open(img).convert("RGB") im = Image.open(img).convert("RGB")