[IPython-User] ipython notebook - how to display image (not from pylab)

Anthony Tanbakuchi anthony@tanbakuchi....
Thu Feb 23 10:14:41 CST 2012


Brian,

Thanks, using Image(filename='myimage.png') works well.

One additional question that I couldn't find from the documents. Is
there a way that I can specify the html image width / height
properties for the displayed image?

Annoyingly, the package I'm using generates very large PNG files that
display way to large to view in the notebook without lots of
scrolling. I'm trying to figure out how to change the output in the
package, but in the mean time, can I just use HTML tags to scale the
image? I'd rather not have to down size the images via post processing
before displaying.

Thanks,

Anthony

On Wed, Feb 22, 2012 at 9:27 PM, Brian Granger <ellisonbg@gmail.com> wrote:
> There are a couple of ways of doing this, but the simplest is the following:
>
> from IPython.core.display import Image
> Image('myimage.png')
>
> Cheers,
>
> Brian
>
> On Wed, Feb 22, 2012 at 7:59 PM, Anthony Tanbakuchi
> <anthony@tanbakuchi.com> wrote:
>> I have a custom module that generates a png image file from some
>> calculations (sadly it doesn't work well for me to use matplotlib to
>> display this image). It's rather slow to read the image back in to
>> matplotlib and display it since it is somewhat large. How can I embed
>> my image similar to how it is done for the pylab inline option?
>>
>> Are there any special hooks in the notebook where I can easily do
>> this? Or is there a way I could just print the html code to display
>> the image file inline? Something like print '<img src="file.png"/>'
>> and have that displayed in the notebook as html rather than code
>> output.
>>
>> Thanks for the great work on the notebook server. It's a great tool.
>>
>> -Anthony
>> _______________________________________________
>> IPython-User mailing list
>> IPython-User@scipy.org
>> http://mail.scipy.org/mailman/listinfo/ipython-user
>
>
>
> --
> Brian E. Granger
> Cal Poly State University, San Luis Obispo
> bgranger@calpoly.edu and ellisonbg@gmail.com
> _______________________________________________
> IPython-User mailing list
> IPython-User@scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-user


More information about the IPython-User mailing list