Image
Last updated
Last updated
Image
widget in Supervisely is a simple widget that displays images using the HTML <img>
tag, and is convenient to use when there is no need to add extra functions for displaying annotations or adjusting their settings, but only to display the image passed to it by url or local path.
Image url or local path to image on the host. Determines image to be displayed on widget.
type: str
default value: ""
Image width in pixels or percent.
type: Optional[Union[int, str]]
default value: None
Image height in pixels or percent.
type: Optional[Union[int, str]]
default value: None
ID of the widget.
type: str
default value: None
You can find this example in our Github repository:
ui-widgets-demos/media/001_image/src/main.py
First, we load environment variables with credentials and init API for communicating with Supervisely Instance:
Image
widgets we will use in UIImage
using image from local directoryPrepare a layout for app using Card
widget with the content
parameter and place widget that we've just created in the Container
widget.
Define static_dir
parameter for using files from local directory. Create an app object with layout
parameter.
Parameters | Type | Description |
---|---|---|
Attributes and Methods | Description |
---|---|
url
str
Image url or local path to image on the host
width
Optional[Union[int, str]]
Image width in pixels or percent
height
Optional[Union[int, str]]
Image height in pixels or percent
widget_id
str
ID of the widget
set(url: str)
Set image by url in Image
widget.
clean_up()
Clean Image
widget from item.
set_image_size(height: Optional[Union[int, str]], width: Optional[Union[int, str]])
Set image size in Image
widget.
show()
Show Image
widget.
hide()
Hide Image
widget.