mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-11-11 12:17:14 +03:00
keep IPython/Jupyter text/plain output stable
This commit is contained in:
parent
2a38670169
commit
b3cb55f823
|
@ -644,6 +644,19 @@ class Image:
|
||||||
id(self),
|
id(self),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def _repr_pretty_(self, p, cycle):
|
||||||
|
"""IPython plain text display support"""
|
||||||
|
|
||||||
|
# Same as __repr__ but without unpredicatable id(self),
|
||||||
|
# to keep Jupyter notebook `text/plain` output stable.
|
||||||
|
p.text("<%s.%s image mode=%s size=%dx%d>" % (
|
||||||
|
self.__class__.__module__,
|
||||||
|
self.__class__.__name__,
|
||||||
|
self.mode,
|
||||||
|
self.size[0],
|
||||||
|
self.size[1],
|
||||||
|
))
|
||||||
|
|
||||||
def _repr_png_(self):
|
def _repr_png_(self):
|
||||||
"""iPython display hook support
|
"""iPython display hook support
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user