After installing iPython and PyQT , you can display the PIL images in the ipython qtconsole
line after executing the following code:
# display_pil.py # source: http://mail.scipy.org/pipermail/ipython-user/2012-March/009706.html # by 'MinRK' import Image from IPython.core import display from io import BytesIO def display_pil_image(im): """displayhook function for PIL Images, rendered as PNG""" b = BytesIO() im.save(b, format='png') data = b.getvalue() ip_img = display.Image(data=data, format='png', embed=True) return ip_img._repr_png_() # register display func with PNG formatter: png_formatter = get_ipython().display_formatter.formatters['image/png'] png_formatter.for_type(Image.Image, display_pil_image)
Usage example:
import Image import display_pil im = Image.open('test.png') im
ipython qtconsole
display the loaded image in a row.
wolfskers
source share