streamdeck-ui icon indicating copy to clipboard operation
streamdeck-ui copied to clipboard

Key image size bug fixes

Open Giraut opened this issue 11 months ago • 0 comments

  • The change to streamdeck_ui/display/image_filter.py scales images up as well as down. PIL's Image.thumbnail method can never return an image larger than the original image, which makes images smaller than the key size such as desktop icons - e.g. with a lower resolution like 32x32 or 48x48 - not fill up the entire key image space. Image.resize lets any icon fill up the key.

  • The change to streamdeck_ui/display/display_grid.py is more subtle:

    If you have more than one Stream Deck connected and they have different key image sizes - for example a Stream Deck XL with 96x96 keys and a Stream Deck Plus with 120x120 keys - two DisplayGrid instances are created. The first one initialize the static class-level EmptyFilter instance upon creation and sets its image size once. Then the second one is created and sets the same EmptyFilter's image size a second time. Meaning all key images changed subsequently will have the key size of the last Stream Deck initialized.

    So in this example, if the Stream Deck Plus is the last one initialized, any key image changed on the Stream Deck XL will be 120x120, then scaled down to 96x96 upon display, appearing too small.

    The issue is fixed by having one EmptyFilter instance per DisplayGrid instance, each with the correct key size for the corresponding Stream Deck.

Giraut avatar Mar 07 '24 16:03 Giraut