Napari Select foreground


AI-based foreground extraction in scientific and natural images.

Select the foreground of images using AI in Napari. This plugin is based on the rembg project.

Why use napari-rembg?

  • It runs fast even on a laptop's CPU (a few seconds per image).
  • It is easy to install compared to other AI tools for segmentation.
  • It is a quick and easy solution to automatically extract the foreground of scientific and natural images.

This plugin is primarily intended for analyzing 2D and 2D (RGB) images, however it can also be used to segment a particular slice in a 2D + time, 2D + channel or 3D image.


Run rembg in individual regions of interest defined by bounding boxes to segment multiple objects:

  • Insert a Shapes layer and draw rectangles to define regions of interest (ROIs) in which to run the foreground selection. You can choose to auto-increment the label index to distinguish objects in different ROIs.
  • Select the Labels layer in which to write the output of the foreground segmentation (or let the plugin create a Labels layer automatically).


You can install napari-rembg via pip:

pip install napari-rembg


Start napari-rembg from the Plugins menu of Napari:

Plugins > Select foreground (napari-rembg)


Contributions are very welcome. Please get in touch if you'd like to be involved in improving or extending the package.


Distributed under the terms of the BSD-3 license, "napari-rembg" is free and open source software.


If you encounter any problems, please file an issue along with a detailed description.

This napari plugin was generated with Cookiecutter using @napari's cookiecutter-napari-plugin template.


  • 0.0.5

Last updated:

  • 15 November 2023

First released:

  • 28 September 2023


Supported data:

  • Information not submitted

Plugin type:

GitHub activity:

  • Stars: 0
  • Forks: 0
  • Issues + PRs: 0

Python versions supported:

Operating system:


  • magicgui
  • qtpy
  • napari[all] >=0.4.16
  • rembg

Sign up to receive updates