Skip to content

Instantly share code, notes, and snippets.

@bczhc
Created January 22, 2026 10:47
Show Gist options
  • Select an option

  • Save bczhc/d942f02d7ab963301c4ed24dbabeaa7f to your computer and use it in GitHub Desktop.

Select an option

Save bczhc/d942f02d7ab963301c4ed24dbabeaa7f to your computer and use it in GitHub Desktop.
Segment Anything and GIMP plugin 使用快速笔记 #sam #gimp

Segment Anything and GIMP plugin

Clone sam1 and sam2 and set up the environment:

git cl https://github.com/facebookresearch/segment-anything
git clone https://github.com/facebookresearch/segment-anything-2.git

cd segment-anything
python -m venv --system-site-packages env
source env/bin/activate
pip install -e .
pip install -e ../segment-anything-2

Download gimpsegany gimp plugin release: https://github.com/Shriinivas/gimpsegany/releases/download/v1.0.0/gimp-segany-gimp3.zip, and unzip it to the gimp plugin folder

You should have:

ls ~/.config/GIMP/3.0/plug-ins/seganyplugin      ✘ INT 18:39:51
segany_settings.json  seganybridge.py  seganyplugin.py

Download the model:

See: https://github.com/facebookresearch/segment-anything?tab=readme-ov-file#model-checkpoints

Test:

/mnt/nvme/op/segment-anything main ❯ source env/bin/activate                   18:44:39
# 6GB of vram is not sufficient. So I disabled GPU totally.
/mnt/nvme/op/segment-anything main ❯ export CUDA_VISIBLE_DEVICES=''
/mnt/nvme/op/segment-anything main ❯ python ~/.config/GIMP/3.0/plug-ins/seganyplugin/seganybridge.py vit_b ~/Downloads/sam_vit_b_01ec64.pth
SAM1 Model loaded successfully!
Success!!

Then start GIMP:

export CUDA_VISIBLE_DEVICES=''gimp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment