Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Refactor] Python-ify QP's converter code #20102

Merged
merged 2 commits into from
Jul 7, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Little refactor
  • Loading branch information
elpekenin committed Mar 12, 2023
commit 13e2746163e980c7989c03859a3cf906574c03fb
4 changes: 2 additions & 2 deletions lib/python/qmk/painter.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ def convert_requested_format(im, format):
def rgb_to565(r, g, b):
msb = ((r >> 3 & 0x1F) << 3) + (g >> 5 & 0x07)
lsb = ((g >> 2 & 0x07) << 5) + (b >> 3 & 0x1F)
return (msb << 8) + lsb
return [msb, lsb]


def convert_image_bytes(im, format):
Expand Down Expand Up @@ -259,7 +259,7 @@ def convert_image_bytes(im, format):
# No palette
palette = None

bytearray = [byte for r, g, b in zip(red, green, blue) for byte in rgb_to565(r, g, b).to_bytes(2, byteorder="big")]
bytearray = [byte for r, g, b in zip(red, green, blue) for byte in rgb_to565(r, g, b)]

if image_format == 'IMAGE_FORMAT_RGB888':
# Take the red, green, and blue channels
Expand Down