Skip to content

Commit

Permalink
try again
Browse files Browse the repository at this point in the history
  • Loading branch information
adriankeenan committed Dec 29, 2024
1 parent 7316b8c commit ad5bc47
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/img_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,13 @@ def resize_img(img: Image, mode: Mode, rotation: Rotation, resize: Resize, backg
x = int((display_res.width - scaled_image.width) / 2)
y = int((display_res.height - scaled_image.height) / 2)
canvas = Image.new(img_mode, display_res, bg_colour)
if mode == Mode.FOUR_GRAY:
canvas = canvas.quantize(palette=get_display_colour_palette())
canvas.paste(scaled_image, (x, y))
if mode == Mode.FOUR_GRAY:
palette_img = Image.new('P', (16, 16))
palette_img.putpalette(get_display_colour_palette() * 32)
palette_img.load()
canvas = canvas.quantize(palette=palette_img)

return canvas


Expand Down

0 comments on commit ad5bc47

Please sign in to comment.