mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-06-19 19:46:41 +00: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)
|
file = io.BytesIO(file)
|
||||||
|
|
||||||
try:
|
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:
|
if image.width <= width and image.height <= height:
|
||||||
return file
|
return file
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user