mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-13 10:46:16 +03:00
Simplified code
This commit is contained in:
parent
6215cd3e0f
commit
e5c94eced2
|
@ -641,9 +641,8 @@ class Image:
|
|||
b = io.BytesIO()
|
||||
try:
|
||||
self.save(b, image_format, **kwargs)
|
||||
except Exception as e:
|
||||
msg = f"Could not save to {image_format} for display"
|
||||
raise ValueError(msg) from e
|
||||
except Exception:
|
||||
return None
|
||||
return b.getvalue()
|
||||
|
||||
def _repr_png_(self):
|
||||
|
@ -651,20 +650,14 @@ class Image:
|
|||
|
||||
:returns: PNG version of the image as bytes
|
||||
"""
|
||||
try:
|
||||
return self._repr_image("PNG", compress_level=1)
|
||||
except Exception:
|
||||
return None
|
||||
return self._repr_image("PNG", compress_level=1)
|
||||
|
||||
def _repr_jpeg_(self):
|
||||
"""iPython display hook support for JPEG format.
|
||||
|
||||
:returns: JPEG version of the image as bytes
|
||||
"""
|
||||
try:
|
||||
return self._repr_image("JPEG")
|
||||
except Exception:
|
||||
return None
|
||||
return self._repr_image("JPEG")
|
||||
|
||||
@property
|
||||
def __array_interface__(self):
|
||||
|
|
Loading…
Reference in New Issue
Block a user