napari.utils.NotebookScreenshot#
- class napari.utils.NotebookScreenshot(viewer, *, canvas_only=False, alt_text=None)[source]#
Bases:
object
Display napari screenshot in the jupyter notebook.
Functions returning an object with a _repr_png_() method will displayed as a rich image in the jupyter notebook.
https://ipython.readthedocs.io/en/stable/api/generated/IPython.display.html
- Parameters:
viewer (napari.Viewer) – The napari viewer.
canvas_only (bool, optional) – If False include the napari viewer frame in the screenshot, and if True then take screenshot of just the image display canvas. By default, False.
alt_text (str, optional) – Image description alternative text, for screenreader accessibility. Good alt-text describes the image and any text within the image in no more than three short, complete sentences. By default, None.
Examples
>>> import napari >>> from napari.utils import nbscreenshot >>> from skimage.data import chelsea
>>> viewer = napari.view_image(chelsea(), name='chelsea-the-cat') >>> nbscreenshot(viewer) # screenshot just the canvas without the napari viewer framing it >>> nbscreenshot(viewer, canvas_only=True)
Methods
Details