-
-
Notifications
You must be signed in to change notification settings - Fork 242
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
Pillow 10.0.0 removed calls that StreamDeck relies upon. #353
Comments
Facing exactly the same issue. This happened just after the Manjaro update of 2023-07-10 and was fully functional just before. Error message
Config OS: Manjaro Linux x86_64 Python packages installed It seems related to a deprecation in the newest version of Pillow (10), but here are the complete list of packages
|
I can't understand what def initialize(self, size: Tuple[int, int]):
self.image = Image.new("RGBA", size)
backdrop_draw = ImageDraw.Draw(self.image)
- # Calculate the height and width of the text we're drawing, using the font itself
- label_w, _ = backdrop_draw.textsize(self.text, font=self.true_font)
- # Calculate dimensions for text that include ascender (above the line)
- # and below the line (descender) characters. This is used to adust the
- # font placement and should allow for button text to horizontally align
- # across buttons. Basically we want to figure out what is the tallest
- # text we will need to draw.
- _, label_h = backdrop_draw.textsize("lLpgyL|", font=self.true_font)
- gap = (size[1] - 5 * label_h) // 4
if self.vertical_align == "top":
label_y = 0
+ anchor = "ma"
elif self.vertical_align == "middle-top":
- label_y = gap + label_h
+ # ???
elif self.vertical_align == "middle":
- label_y = size[1] // 2 - (label_h // 2)
+ label_y = size[1] // 2
+ anchor = "mm"
elif self.vertical_align == "middle-bottom":
- label_y = (gap + label_h) * 3
+ # ???
else:
- label_y = size[1] - label_h
- # Default or "bottom"
+ label_y = size[1]
+ anchor = "md"
- label_pos = ((size[0] - label_w) // 2, label_y)
+ label_pos = (size[0] // 2, label_y)
- backdrop_draw.text(label_pos, text=self.text, font=self.true_font, fill="black")
+ backdrop_draw.text(label_pos, text=self.text, font=self.true_font, fill="black", anchor=anchor)
self.image = self.image.filter(TextFilter.font_blur)
foreground_draw = ImageDraw.Draw(self.image)
- foreground_draw.text(label_pos, text=self.text, font=self.true_font, fill="white")
+ foreground_draw.text(label_pos, text=self.text, font=self.true_font, fill="white", anchor=anchor) |
I added a quick fix, if you want to give it a try. #354 @flajann2 @nulano @shakasan @abcminiuser @lhayhurst |
hi, this project seems to be stale and a new fork as been made with the intention of replacing this one. if this still an issue please reopen it at: https://github.com/streamdeck-linux-gui/streamdeck-linux-gui |
Describe the bug
https://pillow.readthedocs.io/en/stable/releasenotes/10.0.0.html#font-size-and-offset-methods
Because the various calls were deleted,
File "/home/eltoro/.local/lib/python3.11/site-packages/streamdeck_ui/display/text_filter.py", line 43, in initialize
label_w, _ = backdrop_draw.textsize(self.text, font=self.true_font)
^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'ImageDraw' object has no attribute 'textsize'
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Streamdeck comes up and works normally, recognizing the plugged in Streamdeck.
Screenshots
If applicable, add screenshots, pictures or video to help explain your problem.
Operating system (please complete the following information)
OS: Arch Linux x86_64
Host: NH50_70RA
Kernel: 6.4.2-arch1-1
Uptime: 17 hours, 50 mins
Packages: 1577 (pacman), 9 (flatpak)
Shell: fish 3.6.1
Resolution: 3840x2160
DE: Plasma 5.27.6
WM: KWin
Theme: [Plasma], Breeze [GTK2/3]
Icons: [Plasma], breeze-dark [GTK2/3]
Terminal: tmux
CPU: Intel i5-9300H (8) @ 4.100GHz
GPU: NVIDIA GeForce GTX 1650 Mobile / Max-Q
GPU: Intel CoffeeLake-H GT2 [UHD Graphics 630]
Memory: 11902MiB / 31938MiB
Stream Deck Version
The text was updated successfully, but these errors were encountered: