Launch napari and display an image#

Launch an instance of napari and simultaneously display an image using the imshow() API. This example can be run to recreate the README image.

Tags: visualization-basic

imshow
/home/runner/work/docs/docs/.venv/lib/python3.12/site-packages/napari/_qt/qt_event_loop.py:50: UserWarning: System theme detection requires a Qt6 backend. Please switch to PyQt6 or PySide6 to use it.
  theme_type=get_system_theme(),
/home/runner/work/docs/docs/.venv/lib/python3.12/site-packages/napari/_qt/qt_event_loop.py:50: UserWarning: System theme detection requires a Qt6 backend. Please switch to PyQt6 or PySide6 to use it.
  theme_type=get_system_theme(),

from skimage import data

import napari

viewer, layers = napari.imshow(data.cells3d(), channel_axis=1, ndisplay=3)

# To recreate the README image uncomment the following lines:
# viewer.window._qt_window.resize(800, 600)
# napari._qt.qt_event_loop.get_qapp().processEvents()  # Ensure the window is done rendering before taking a screenshot
# viewer.screenshot('./src/napari/resources/multichannel_cells.png', canvas_only=False)

if __name__ == '__main__':
    napari.run()

Gallery generated by Sphinx-Gallery