-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consider implementing _repr_png_ for the Image object #1090
Comments
I've got a branch with that method in it now, (https://github.com/wiredfool/Pillow/tree/repr_png) but it does not seem to trigger iPython's display hooks. Can you give a step by step to test it, or determine what else needs to be added to make it work? |
The method is To test in an IPython web notebook: from PIL import Image
im = Image.new("RGB", (512, 512), "blue")
im IPython will attempt to render the last value. When it finds |
The problem was GitHub interpreted the underscores as italic markup. I've edited to wrap backticks ` around the function to make sure it's in code markup! |
Ah, my bad -- sorry about that. I should have checked the preview more carefully. |
Ah, much better. Works now. |
Implemented via #1091, thanks. |
Given the popularity of IPython, consider implementing a
_repr_png_()
method for the Image object, which just returns the object in PNG form. If this method exists on an object, the IPython notebook will display the rich image representation in-line.See: http://nbviewer.ipython.org/github/adrn/ipython/blob/1.x/examples/notebooks/Part%205%20-%20Rich%20Display%20System.ipynb
This can be done without dependency on or reference to IPython.
The text was updated successfully, but these errors were encountered: