[IPython-User] ipython notebook help

MinRK benjaminrk@gmail....
Wed Jul 18 16:49:55 CDT 2012

On Wed, Jul 18, 2012 at 4:12 PM, Thomas Kluyver <takowl@gmail.com> wrote:

> Hi Darren,
> On 18 July 2012 22:01, Darren Govoni <darren@ontrenet.com> wrote:
> > 1) Is there a thorough tutorial on notebook? From hello world to the UI
> > features?
> There's a folder of example notebooks, including an introduction one.
> They may have come with your installation, depending on where you got
> it from, or you can get them here:
> https://github.com/ipython/ipython/tree/master/docs/examples/notebooks
> > 2) I want to do some image processing with it. Is there an example (or
> is it possible) > to interact with image data? e.g. run some ipython code,
> return/display the image result?
> It's certainly possible, although I don't know if there's an example
> yet. For simple cases, matplotlib has imread() and imshow() functions.
> Working with PIL might need a little integration, but hopefully just a
> few extra lines.

Here is a notebook I made while trying to follow along with one of
Fernando's Py4Science tutorials, which covered working with image data:


It includes the code for automatically displaying PIL objects as images in
the notebook, which I added later:

from io import BytesIO

def display_image(img, format='PNG'):
    fp = BytesIO()
    img.save(fp, format=format)
    return fp.getvalue()

ip = get_ipython()
png_formatter = ip.display_formatter.formatters['image/png']
png_formatter.for_type_by_name('Image', 'Image', display_image)

which we might want to have on by default.


> Best wishes,
> Thomas
> _______________________________________________
> IPython-User mailing list
> IPython-User@scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-user
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/ipython-user/attachments/20120718/0b1d08d9/attachment.html 

More information about the IPython-User mailing list