Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

showing an external image in sage notbook

Is there an easy way to show an image stored in local drive (or a website) in sage notebook?

The only way I know is using matplotlib:

import matplotlib.pyplot as plt
import matplotlib.image as mpimg

img=mpimg.imread('<location of image file')
plt.imshow(img)
frame = plt.gca()
frame.axes.get_xaxis().set_visible(False)
frame.axes.get_yaxis().set_visible(False)
plt.savefig("temp.png")

but, it is a roundabout way and shows the unecessary black border around the image.