Skip to content

Commit 6f26289

Browse files
Check that image_file parameter to printImage is a string before trying to open like a path
1 parent 3e7be0b commit 6f26289

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Adafruit_Thermal.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,11 @@ def printBitmap(self, w, h, bitmap, LaaT=False):
549549
# passing the result to this function.
550550
def printImage(self, image_file, LaaT=False):
551551
from PIL import Image
552-
image = Image.open(image_file)
552+
image = image_file
553+
554+
if isinstance(image_file, str):
555+
image = Image.open(image_file)
556+
553557
if image.mode != '1':
554558
image = image.convert('1')
555559

0 commit comments

Comments
 (0)