Create a PNG/JPEG/GIF/WEBP image object given raw data. When this object is returned by an input cell or passed to the display function, it will result in the image being displayed in the frontend. Parameters ---------- data : unicode, str or bytes
(
self,
data=None,
url=None,
filename=None,
format=None,
embed=None,
width=None,
height=None,
retina=False,
unconfined=False,
metadata=None,
alt=None,
)
| 866 | } |
| 867 | |
| 868 | def __init__( |
| 869 | self, |
| 870 | data=None, |
| 871 | url=None, |
| 872 | filename=None, |
| 873 | format=None, |
| 874 | embed=None, |
| 875 | width=None, |
| 876 | height=None, |
| 877 | retina=False, |
| 878 | unconfined=False, |
| 879 | metadata=None, |
| 880 | alt=None, |
| 881 | ): |
| 882 | """Create a PNG/JPEG/GIF/WEBP image object given raw data. |
| 883 | |
| 884 | When this object is returned by an input cell or passed to the |
| 885 | display function, it will result in the image being displayed |
| 886 | in the frontend. |
| 887 | |
| 888 | Parameters |
| 889 | ---------- |
| 890 | data : unicode, str or bytes |
| 891 | The raw image data or a URL or filename to load the data from. |
| 892 | This always results in embedded image data. |
| 893 | |
| 894 | url : unicode |
| 895 | A URL to download the data from. If you specify `url=`, |
| 896 | the image data will not be embedded unless you also specify `embed=True`. |
| 897 | |
| 898 | filename : unicode |
| 899 | Path to a local file to load the data from. |
| 900 | Images from a file are always embedded. |
| 901 | |
| 902 | format : unicode |
| 903 | The format of the image data (png/jpeg/jpg/gif/webp). If a filename or URL is given |
| 904 | for format will be inferred from the filename extension. |
| 905 | |
| 906 | embed : bool |
| 907 | Should the image data be embedded using a data URI (True) or be |
| 908 | loaded using an <img> tag. Set this to True if you want the image |
| 909 | to be viewable later with no internet connection in the notebook. |
| 910 | |
| 911 | Default is `True`, unless the keyword argument `url` is set, then |
| 912 | default value is `False`. |
| 913 | |
| 914 | Note that QtConsole is not able to display images if `embed` is set to `False` |
| 915 | |
| 916 | width : int |
| 917 | Width in pixels to which to constrain the image in html |
| 918 | |
| 919 | height : int |
| 920 | Height in pixels to which to constrain the image in html |
| 921 | |
| 922 | retina : bool |
| 923 | Automatically set the width and height to half of the measured |
| 924 | width and height. |
| 925 | This only works for embedded images because it reads the width/height |
nothing calls this directly
no test coverage detected