-
Book Overview & Buying
-
Table Of Contents
IPython Notebook Essentials
By :
In an exciting development, recent versions of IPython include the capability to display images, video, sound, and other media directly in the notebook. The classes that support the display system are in the IPython.display module. In this section, we will discuss some of the supported formats.
Images can be loaded either from the local filesystem or from the web. To display the image contained in the character.png file, for example, run the following command in a cell:
from IPython.display import Image Image('character.png')
It is also possible to store the image in a variable to be displayed at a later time:
img = Image('character.png')
The character.png file can be downloaded from the web page of this book.
To display the image, we can use either img or display(img). The following image is displayed:

To load an image from the Web, simply give its URL as an argument:
Image('http://www.imagesource.com/Doc/IS0/Media/TR5...
Change the font size
Change margin width
Change background colour