##// END OF EJS Templates
Embed image as default...
Matthias BUSSONNIER -
Show More
@@ -422,7 +422,7 b' class Image(DisplayObject):'
422 422
423 423 _read_flags = 'rb'
424 424
425 def __init__(self, data=None, url=None, filename=None, format=u'png', embed=False):
425 def __init__(self, data=None, url=None, filename=None, format=u'png', embed=None):
426 426 """Create a display an PNG/JPEG image given raw data.
427 427
428 428 When this object is returned by an expression or passed to the
@@ -441,10 +441,24 b' class Image(DisplayObject):'
441 441 The format of the image data (png/jpeg/jpg). If a filename or URL is given
442 442 for format will be inferred from the filename extension.
443 443 embed : bool
444 Should the image data be embedded in the notebook using a data URI (True)
445 or be loaded using an <img> tag. Set this to True if you want the image
446 to be viewable later with no internet connection. If a filename is given
447 embed is always set to True.
444 Should the image data be embedded using a data URI (True) or be
445 loaded using an <img> tag. Set this to True if you want the image
446 to be viewable later with no internet connection in the notebook.
447
448 Default is `True`, unless the keyword argument `url` is set, then
449 default value is `False`.
450
451 Note that QtConsole is not able to display images if `embed` is set to `False`
452
453 Examples
454 --------
455 # embed implicitely True, works in qtconsole and notebook
456 Image('http://www.google.fr/images/srpr/logo3w.png')
457
458 # embed implicitely False, does not works in qtconsole but works in notebook if
459 # internet connexion availlable
460 Image(url='http://www.google.fr/images/srpr/logo3w.png')
461
448 462 """
449 463 if filename is not None:
450 464 ext = self._find_ext(filename)
@@ -460,7 +474,7 b' class Image(DisplayObject):'
460 474 if ext == u'png':
461 475 format = u'png'
462 476 self.format = unicode(format).lower()
463 self.embed = True if filename is not None else embed
477 self.embed = embed if embed is not None else (url is None)
464 478 super(Image, self).__init__(data=data, url=url, filename=filename)
465 479
466 480 def reload(self):
General Comments 0
You need to be logged in to leave comments. Login now