Update rgb_to_color565

pull/14/head
Ethan 2024-05-20 16:56:10 -07:00 zatwierdzone przez GitHub
rodzic 30384dbd0b
commit ea6918ed8f
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: B5690EEEBB952194
1 zmienionych plików z 4 dodań i 2 usunięć

Wyświetl plik

@ -56,8 +56,10 @@ def rgb_to_color565(r, g, b):
Returns:
int: Converted color value in the 16-bit color format (565).
"""
return ((r & 0xF8) << 8) | ((g & 0xFC) << 3) | (b & 0xF8)
r = ((r * 31) // (255))
g = ((g * 63) // (255))
b = ((b * 31) // (255))
return (r << 11) | (g << 5) | b
def convert_to_bitmap(image_file, bits_requested):