Show More
@@ -540,13 +540,25 b' class Image(DisplayObject):' | |||
|
540 | 540 | height = ' height="%d"' % self.height |
|
541 | 541 | return u'<img src="%s"%s%s/>' % (self.url, width, height) |
|
542 | 542 | |
|
543 | def _data_and_metadata(self): | |
|
544 | """shortcut for returning metadata with shape information, if defined""" | |
|
545 | md = {} | |
|
546 | if self.width: | |
|
547 | md['width'] = self.width | |
|
548 | if self.height: | |
|
549 | md['height'] = self.height | |
|
550 | if md: | |
|
551 | return self.data, md | |
|
552 | else: | |
|
553 | return self.data | |
|
554 | ||
|
543 | 555 | def _repr_png_(self): |
|
544 | 556 | if self.embed and self.format == u'png': |
|
545 | return self.data | |
|
557 | return self._data_and_metadata() | |
|
546 | 558 | |
|
547 | 559 | def _repr_jpeg_(self): |
|
548 | 560 | if self.embed and (self.format == u'jpeg' or self.format == u'jpg'): |
|
549 | return self.data | |
|
561 | return self._data_and_metadata() | |
|
550 | 562 | |
|
551 | 563 | def _find_ext(self, s): |
|
552 | 564 | return unicode(s.split('.')[-1].lower()) |
General Comments 0
You need to be logged in to leave comments.
Login now