Skip to content

Commit 72b299b

Browse files
author
DESKTOP-M9CCUTI\ian
committed
flip image if width is less than height
1 parent bf74659 commit 72b299b

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

display/image.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,14 @@ def process_bitmap(image_path):
4545
width, height = image.size
4646

4747
image = image.convert("RGB")
48+
49+
# Flip the image 90 degrees (270 degrees counterclockwise) if width is less than height
50+
if width < height:
51+
image = image.transpose(Image.ROTATE_270)
52+
4853
image = image.transpose(Image.FLIP_TOP_BOTTOM) # Mirror the image horizontally
4954
#flip the image 90 degrees
50-
image = image.transpose(Image.ROTATE_270)
55+
#image = image.transpose(Image.ROTATE_270)
5156
pixel_data = convert_to_565(image)
5257
save_as_c_header(os.path.basename(image_path), pixel_data, width, height)
5358
print(f"Processed {image_path} and saved as C header.")

0 commit comments

Comments
 (0)