Skip to content

Commit 68bd2d1

Browse files
committed
Fix image height/width not honored in rev C's DisplayPILImage
1 parent 4844d1f commit 68bd2d1

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

library/lcd/lcd_comm_rev_c.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,9 @@ def DisplayPILImage(
282282
if image.size[0] > self.get_width():
283283
image_width = self.get_width()
284284

285+
if image_width != image.size[0] or image_height != image.size[1]:
286+
image = image.crop((0, 0, image_width, image_height))
287+
285288
assert x <= self.get_width(), 'Image X coordinate must be <= display width'
286289
assert y <= self.get_height(), 'Image Y coordinate must be <= display height'
287290
assert image_height > 0, 'Image height must be > 0'

0 commit comments

Comments
 (0)