mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-13 04:56:35 +03:00
Prevent pillow from closing non-exclusive fps (#1121)
This commit is contained in:
parent
ae8f1fed05
commit
fcfebf75a3
|
@ -44,7 +44,9 @@ def _resize_photo_if_needed(
|
|||
file = io.BytesIO(file)
|
||||
|
||||
try:
|
||||
with PIL.Image.open(file) as image:
|
||||
# Don't use a `with` block for `image`, or `file` would be closed.
|
||||
# See https://github.com/LonamiWebs/Telethon/issues/1121 for more.
|
||||
image = PIL.Image.open(file)
|
||||
if image.width <= width and image.height <= height:
|
||||
return file
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user