File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 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):
427427 height = self .height
428428 if self .rotation == 1 or self .rotation == 3 :
429429 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" :
431434 raise ValueError ("Image must be in mode 1." )
435+
432436 imwidth , imheight = img .size
433437 if imwidth != width or imheight != height :
434438 raise ValueError (
@@ -444,7 +448,9 @@ def image(self, img):
444448 # Iterate through the pixels
445449 for x in range (width ): # yes this double loop is slow,
446450 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 )]:
448454 self .pixel (x , y , 1 ) # only write if pixel is true
449455
450456
You can’t perform that action at this time.
0 commit comments