Added _repr_jpeg_() for IPython display_jpeg#7135
Added _repr_jpeg_() for IPython display_jpeg#7135hugovk merged 11 commits intopython-pillow:mainfrom n3011:jpg_repr
Conversation
Signed-off-by: Ishant Mrinal Haloi <mrinal.haloi11@gmail.com>
|
If I understand correctly, this is not just for passing an image object directly to IPython, like in #1090 (comment) from PIL import Image
im = Image.new("RGB", (512, 512), "blue")
imand not just for |
Yes this is |
_repr_jpg_ for ipython display_repr_jpg_ for IPython display
src/PIL/Image.py
Outdated
| ) | ||
|
|
||
| def _repr_png_(self): | ||
| def _repr_image(self, format): |
There was a problem hiding this comment.
Can we change format to something that doesn't shadow a builtin?
Co-authored-by: Andrew Murray <3112309+radarhere@users.noreply.github.com>
Only assert image is similar
Co-authored-by: Andrew Murray <3112309+radarhere@users.noreply.github.com>
_repr_jpg_ for IPython display_repr_jpeg_ for IPython display
Co-authored-by: Ondrej Baranovič <3819630+nulano@users.noreply.github.com> Co-authored-by: Andrew Murray <3112309+radarhere@users.noreply.github.com>
hugovk
left a comment
There was a problem hiding this comment.
Please could you also mention this in the release notes?
https://github.com/python-pillow/Pillow/blob/main/docs/releasenotes/10.0.0.rst
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Added release notes
|
Release notes have now been added - https://pillow--7135.org.readthedocs.build/en/7135/releasenotes/10.0.0.html#support-display-jpeg-in-ipython |
_repr_jpeg_ for IPython display_repr_jpeg_ for IPython display_jpeg
_repr_jpeg_ for IPython display_jpeg|
I'm wondering what the purpose of this change is. I'm interested to know if it's mainly to support calling If so, this seems to be having unintended consequences as I'm now getting both a PNG and JPEG encoded image saved in each cell. For example, a cell I just created includes: which might well double resulting |
Yes. That is what the original poster was after, and that is what we have announced. Discussion of double images can continue in #7259 |
Changes proposed in this pull request:
_repr_jpg_and_repr_jpeg_method for ipython display (similar to currently existing_repr_png_)