This project is a hard fork of Shriinivas/gimpsegany — all the original plugin architecture, the GIMP 3 integration, and SAM1/SAM2 support are their work. GIMPSAM is an updated version built on top of that foundation to have support to the latest SAM 3 model with text-based segmentation, an easier installer, optimized parallel performance and a tighter integration with the LazyGIMP project.
You can find the downloadable files in the latest release.
One-liner
curl -fsSL https://raw.githubusercontent.com/pierspad/GIMPSAM/main/installer.py | python3 - --ephemeral
From source:
git clone https://github.com/pierspad/GIMPSAM
cd GIMPSAM
python3 installer.py # GUI
python3 installer.py --help # CLI
Running with no arguments opens the GUI, which walks you through the plug-in, the Python backend, and a model download. Any subcommand runs headless instead.
| Command | Description |
|---|---|
| (none) | Opens the GUI wizard |
status | Plug-in, backend, and installed models |
install | Plug-in + backend + a recommended model, in one go |
remove | Removes the plug-in, the backend, and every model |
plugin install [--ref <git-ref>] / plugin remove | Just the GIMP plug-in files |
backend install [--torch-index <url>] / backend remove | Just the venv + PyTorch + SAM |
model list | Every SAM checkpoint and its install state |
model install <key> / model remove <key> | Download or delete a specific checkpoint, e.g. sam2_hiera_small |
sam3 download --token <hf_token> | Downloads the gated SAM 3 weights from Hugging Face |
sam3 remove | Deletes the SAM 3 checkpoint |
sam3 transformers | Installs/upgrades transformers (required to run SAM 3) |
--torch-index accepts any of the known PyTorch wheel indexes (CPU, CUDA 13.2/13.0/12.8, ROCm 7.2/6.4, Intel XPU) — omit it and it's auto-detected from your GPU. --ephemeral self-deletes the installer once the GUI closes.
If you'd rather not use the installer at all:
Edit > Preferences > Folders > Plug-ins inside GIMP, or the defaults:
~/.config/GIMP/3.0/plug-ins/C:\Users\[YourUsername]\AppData\Roaming\GIMP\3.0\plug-ins\~/Library/Application Support/GIMP/3.0/plug-ins/seganyplugin folder inside it and copy seganyplugin.py and seganybridge.py into it. On Linux/macOS, make sure both are executable (chmod +x seganyplugin.py seganybridge.py).python3 -m venv ~/.local/share/lazygimp/segany/venv).https://download.pytorch.org/whl/cpu, or the matching CUDA/ROCm/XPU index for a GPU (see the list above).pip install numpy pillow opencv-python-headless.pip install git+https://github.com/facebookresearch/segment-anything.gitpip install git+https://github.com/facebookresearch/segment-anything-2.gitpip install transformers huggingface_hub (no separate repo needed — see the SAM3 section below)gimpsam/models.py's MODEL_REGISTRY; SAM3 requires requesting access on Hugging Face first, then downloading with huggingface_hub.snapshot_download(repo_id="facebook/sam3", local_dir=..., token=...).Sanity-check the backend directly, independent of GIMP:
/path/to/python3 ./seganybridge.py auto /path/to/checkpoint/sam_vit_l_0b3195.pth
A Success!! message indicates a working installation.
See tools/bench_bridge.py and tools/headless_e2e.sh for deeper correctness/speed checks.
Open GIMP. Under the "Image" menu, you'll find a new submenu called "Segment Anything Layers" — open an image and click it to bring up the dialog.
Main options:
"car" or "person wearing a red hat".Expert Mode (collapsed by default — raw paths and tuning for auto-segmentation):
For SAM3 you need to request access on Hugging Face to download the models. SAM3 uses transformers' own Sam3Model/Sam3Processor rather than Meta's standalone repo, so it runs on CPU (slowly — expect several seconds per image) without needing Python 3.12+.
Pull requests are welcome! For major changes, please open an issue first to discuss your ideas.
This project was developed with the assistance of Large Language Models, used to support code writing and documentation.
This project is licensed under the GPL v3 License — see the LICENSE file for details.
22 commits
7 commits
Python
96.2%
Shell
3.8%
This project is a hard fork of Shriinivas/gimpsegany — all the original plugin architecture, the GIMP 3 integration, and SAM1/SAM2 support are their work. GIMPSAM is an updated version built on top of that foundation to have support to the latest SAM 3 model with text-based segmentation, an easier installer, optimized parallel performance and a tighter integration with the LazyGIMP project.
You can find the downloadable files in the latest release.
One-liner
curl -fsSL https://raw.githubusercontent.com/pierspad/GIMPSAM/main/installer.py | python3 - --ephemeral
From source:
git clone https://github.com/pierspad/GIMPSAM
cd GIMPSAM
python3 installer.py # GUI
python3 installer.py --help # CLI
Running with no arguments opens the GUI, which walks you through the plug-in, the Python backend, and a model download. Any subcommand runs headless instead.
| Command | Description |
|---|---|
| (none) | Opens the GUI wizard |
status | Plug-in, backend, and installed models |
install | Plug-in + backend + a recommended model, in one go |
remove | Removes the plug-in, the backend, and every model |
plugin install [--ref <git-ref>] / plugin remove | Just the GIMP plug-in files |
backend install [--torch-index <url>] / backend remove | Just the venv + PyTorch + SAM |
model list | Every SAM checkpoint and its install state |
model install <key> / model remove <key> | Download or delete a specific checkpoint, e.g. sam2_hiera_small |
sam3 download --token <hf_token> | Downloads the gated SAM 3 weights from Hugging Face |
sam3 remove | Deletes the SAM 3 checkpoint |
sam3 transformers | Installs/upgrades transformers (required to run SAM 3) |
--torch-index accepts any of the known PyTorch wheel indexes (CPU, CUDA 13.2/13.0/12.8, ROCm 7.2/6.4, Intel XPU) — omit it and it's auto-detected from your GPU. --ephemeral self-deletes the installer once the GUI closes.
If you'd rather not use the installer at all:
Edit > Preferences > Folders > Plug-ins inside GIMP, or the defaults:
~/.config/GIMP/3.0/plug-ins/C:\Users\[YourUsername]\AppData\Roaming\GIMP\3.0\plug-ins\~/Library/Application Support/GIMP/3.0/plug-ins/seganyplugin folder inside it and copy seganyplugin.py and seganybridge.py into it. On Linux/macOS, make sure both are executable (chmod +x seganyplugin.py seganybridge.py).python3 -m venv ~/.local/share/lazygimp/segany/venv).https://download.pytorch.org/whl/cpu, or the matching CUDA/ROCm/XPU index for a GPU (see the list above).pip install numpy pillow opencv-python-headless.pip install git+https://github.com/facebookresearch/segment-anything.gitpip install git+https://github.com/facebookresearch/segment-anything-2.gitpip install transformers huggingface_hub (no separate repo needed — see the SAM3 section below)gimpsam/models.py's MODEL_REGISTRY; SAM3 requires requesting access on Hugging Face first, then downloading with huggingface_hub.snapshot_download(repo_id="facebook/sam3", local_dir=..., token=...).Sanity-check the backend directly, independent of GIMP:
/path/to/python3 ./seganybridge.py auto /path/to/checkpoint/sam_vit_l_0b3195.pth
A Success!! message indicates a working installation.
See tools/bench_bridge.py and tools/headless_e2e.sh for deeper correctness/speed checks.
Open GIMP. Under the "Image" menu, you'll find a new submenu called "Segment Anything Layers" — open an image and click it to bring up the dialog.
Main options:
"car" or "person wearing a red hat".Expert Mode (collapsed by default — raw paths and tuning for auto-segmentation):
For SAM3 you need to request access on Hugging Face to download the models. SAM3 uses transformers' own Sam3Model/Sam3Processor rather than Meta's standalone repo, so it runs on CPU (slowly — expect several seconds per image) without needing Python 3.12+.
Pull requests are welcome! For major changes, please open an issue first to discuss your ideas.
This project was developed with the assistance of Large Language Models, used to support code writing and documentation.
This project is licensed under the GPL v3 License — see the LICENSE file for details.
22 commits
7 commits
Python
96.2%
Shell
3.8%