Skip to content

Latest commit

 

History

History
107 lines (67 loc) · 6.59 KB

README.md

File metadata and controls

107 lines (67 loc) · 6.59 KB

withoutBG: Krita Plugin

withoutBG cutout in Krita as a transparency mask

Remove backgrounds in Krita. Private and on-device: nothing leaves your machine.

A Krita 5.2+ / 6 plugin that talks to your local withoutBG server (Mac Local API or Docker). The cutout lands as a non-destructive transparency mask you can review and refine before committing, and Smart brush fixes the mask from a few strokes.

Plugin page → · Local API docs →

Requirements

Dependency Notes
Krita 5.2+ (PyQt5) or 6 (PyQt6) krita.org
withoutBG server Running at http://127.0.0.1:8000: Docker service-cpu / service-gpu, or the Mac app Local API. The URL can be changed in the dialog.

Start a server

Docker (CPU or GPU, any platform):

docker run --rm -p 8000:8000 withoutbg/withoutbg-openweights-v4-service-cpu:latest

Mac app: download, then start the Local API from the menu bar (port 8000). Run one backend at a time on port 8000.

Install

From a checkout:

./install.sh

Or build a zip (scripts/package.sh) and use Krita's Settings ▸ Configure Krita ▸ Python Plugin Manager ▸ Import Python plugin from file…

Then restart Krita, tick withoutBG in the Python Plugin Manager, and restart once more.

withoutBG ticked in Krita's Python Plugin Manager

The actions appear under:

Tools ▸ Scripts ▸ withoutBG: Remove Background…
Tools ▸ Scripts ▸ withoutBG: Smart Brush…

The withoutBG actions under Tools ▸ Scripts

Usage

  1. Select the layer you want to cut out (a paint layer, not a group).
  2. Tools ▸ Scripts ▸ withoutBG: Remove Background…, then Remove Background.
  3. The cutout is added as a transparency mask named withoutBG. Review it. Right-click the mask in the Layers docker ▸ Merge to commit, or delete it to discard.

Running it again on the same layer keeps the earlier mask, hidden, as withoutBG (previous). (Krita scripts cannot add to the undo stack, so this is the way back.)

Fix the mask with Smart brush

Smart brush in Krita: Keep and Remove strokes on the cutout. Click to watch the demo.

  1. With the layer selected, open Tools ▸ Scripts ▸ withoutBG: Smart Brush…. The dialog shows the cutout on a checkerboard.
  2. Draw on it. Keep (green) over what went missing, Remove (red) over what should go. Strokes are smoothed; a rough line is enough.
  3. Apply updates the mask in place. Paint more and Apply again, or Done.

Controls: brush size slider/field ([ / ], Ctrl + scroll), Background (how much removed background shows through), Undo stroke (Ctrl+Z), Clear, X switches Keep/Remove, right-drag paints the other colour. Revert puts the mask back as it was when the dialog opened. Hand edits to the mask are kept: Smart brush starts from the mask as it is. After the first Apply, later ones are faster (the plugin keeps a small edit context for the layer, saved in the .kra).

Smart brush runs on the local open-weights server (v4). On a cutout made with withoutBG Pro it runs on Pro: each Apply sends the photo and every stroke so far (stateless, 1 credit per Apply).

Optional: withoutBG Pro

No server, or want the hosted model? Tick Use withoutBG Pro (cloud) and paste an API key, or set WITHOUTBG_API_KEY in the environment Krita starts from. The layer (downscaled to 1024 px) goes to api.withoutbg.com and uses 1 credit; the matte still comes back as a mask. A typed key is saved in Krita's settings; use the environment variable to keep it out. Keys: withoutBG Pro.

Uninstall

rm -rf ~/Library/Application\ Support/krita/pykrita/withoutbg{,.desktop}   # macOS
rm -rf ~/.local/share/krita/pykrita/withoutbg{,.desktop}                   # Linux

Development

uv run --no-project --with pytest --with PyQt6 python -I -m pytest tests   # or --with PyQt5

Tests cover the HTTP client, stroke rendering and the dialogs offscreen; the Krita-facing code (withoutbg/kritaio.py, extension.py) needs Krita itself.

More than Krita

Surface Choose when
GIMP plugin Same workflow in GIMP 3
Mac app A native desktop cutout tool, with a Local API for this plugin
Docker / self-host HTTP API or browser UI on your own server
Python package Scripts, notebooks, backends
Hugging Face The ONNX weights

Model

The withoutBG Open Weights Model (v4) is a routed bundle: a trained router sends fine strands, soft detail and transparency to the withoutBG matting branch and hard opaque objects, flat scenes and vehicles to BiRefNet. Built with DINOv3. Licensed under the withoutBG Open Model License (Apache 2.0 for withoutBG portions; Meta DINOv3 License for DINOv3 backbone weights). The plugin code is GPL-3.0-or-later, like Krita.

Support