File tree 1 file changed +8
-2
lines changed
1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -427,8 +427,12 @@ def image(self, img):
427
427
height = self .height
428
428
if self .rotation == 1 or self .rotation == 3 :
429
429
width , height = height , width
430
- if img .mode != "1" :
430
+
431
+ if isinstance (self .format , RGB888Format ) and img .mode != "RGB" :
432
+ raise ValueError ("Image must be in mode RGB." )
433
+ if isinstance (self .format , (MHMSBFormat , MVLSBFormat )) and img .mode != "1" :
431
434
raise ValueError ("Image must be in mode 1." )
435
+
432
436
imwidth , imheight = img .size
433
437
if imwidth != width or imheight != height :
434
438
raise ValueError (
@@ -444,7 +448,9 @@ def image(self, img):
444
448
# Iterate through the pixels
445
449
for x in range (width ): # yes this double loop is slow,
446
450
for y in range (height ): # but these displays are small!
447
- if pixels [(x , y )]:
451
+ if img .mode == "RGB" :
452
+ self .pixel (x , y , pixels [(x , y )])
453
+ elif pixels [(x , y )]:
448
454
self .pixel (x , y , 1 ) # only write if pixel is true
449
455
450
456
You can’t perform that action at this time.
0 commit comments