scistag.vislog.visual_image_logger.VisualImageLogger¶
- class VisualImageLogger(log_builder)[source]¶
Bases:
objectHelper class for storing images in a VisualLog
- Parameters
log_builder (
VisualLogBuilder) – The log builder object we are logging with
Methods
Attributes
__dict____doc____module____weakref__list of weak references to the object (if defined)
The log we are logging to
The log builder we are using to write data
- __call__(source, name=None, alt_text=None, pixel_format=None, download=False, scaling=1.0, max_width=None, optical_scaling=1.0, html_linebreak=True)[source]¶
Adds an image to the log.
- Parameters
name (str | None) – The name of the image under which it shall be stored on disk (in case write_to_disk is enabled).
source (Image | Canvas | str | bytes | np.ndarray) – The data object, e.g. an scitag.imagestag.Image, a numpy array, an URL or a FileStag compatible link.
alt_text (str | None) – An alternative text if no image can be displayed
pixel_format (Optional['PixelFormat'] | str | None) – The pixel format (in case the image is passed as numpy array). By default gray will be used for single channel, RGB for triple band and RGBA for quad band sources.
download (bool) – Defines if an image shall be downloaded
scaling (float) – The factor by which the image shall be scaled
max_width (int | float | None) –
Defines if the image shall be scaled to a given size.
Possible values - True = Scale to the log’s max_fig_size. - float = Scale the image to the defined percentual size of the
max_fig_size, 1.0 = max_fig_size
optical_scaling (float) – Defines the factor with which the image shall be visualized on the html page without really rescaling the image itself and thus giving the possibility to zoom in the browser.
html_linebreak – Defines if a linebreak shall be inserted after the image.
- static _build_get_embedded_image(source)[source]¶
Encodes an image to ASCII to embed it directly into an HTML page
- _insert_image_reference(name, source, alt_text, scaling=1.0, max_width=None, html_scaling=1.0, html_linebreak=True)[source]¶
Inserts a link to an image in the html logger without actually downloading or storing the image locally
- Parameters
name – The image’s name
source – The url
alt_text – The alternative display text
scaling (float) – The scaling factor
max_width (int | None) – The image’s maximum width in pixels
html_scaling (float) – Defines the factor with which the image shall be visualized on the html page without really rescaling the image itself and thus giving the possibility to zoom in the browser.
html_linebreak (bool) – Defines if a linebreak shall be inserted after the image
- _need_to_store_images_on_disk()[source]¶
Returns if images NEED to be stored on disk
- Return type
- Returns
True if they do
- builder: VisualLogBuilder¶
The log builder we are using to write data