A Krita plugin that brings the FLUX models from Black Forest Labs (BFL) and Google's Nano Banana 2 (Gemini image models) directly into Krita — for text-to-image, context-based inpainting and mask-based inpainting, with an optional reference image. The interface is multilingual (English / Deutsch / 中文 / ไทย).
- Two providers side by side — pick a BFL FLUX model or a Google Nano Banana 2 model from the same dropdown; the plugin routes to the right API automatically.
- New image (text → image) — generate an image from a prompt.
- Context Inpaint — edits the current selection context-based
(FLUX.2
input_imageor Gemini image editing, no mask needed). Great for instructions like “remove the person” or “replace the sky”. - Mask Inpaint (FLUX.1 Fill) — precise filling exactly inside the selection
via
image+mask(flux-pro-1.0-fill). FLUX only. - Reference image (optional) — an additional image used as a template, e.g. a specific pair of sunglasses that a selected cat should wear.
- Batch / variants — generate up to 8 results per click, each with its own seed, collected into an AI Batch layer group so you can pick the best.
- Seed control — random seed by default; lock a seed (or roll a new one) to reproduce a result or make controlled variations.
- Aspect-ratio presets — 1:1, 3:2, 16:9, 4:3, … (or custom width/height).
- Cancel button — abort a running request instead of waiting for the poll.
- Multilingual UI — switch language at runtime under Options.
- Adaptive crop with context padding, feathered mask edges (no visible seams), correct color handling and readable error messages.
- Krita 5.x (includes Python/PyQt5 in the official builds).
- For FLUX: a BFL API key from https://api.bfl.ai (the BFL dashboard).
- For Nano Banana 2: a Google AI Studio API key from https://aistudio.google.com/apikey.
- You only need the key(s) for the provider(s) you actually use. Both are paid / metered services.
- Grab
krita-ai-api-diffusion.zipfrom the repo’s Releases (or build it yourself: runpython build_zip.py, which writes it todist/). - In Krita: Tools → Scripts → Import Python Plugin from File and select the ZIP.
- Open Settings → Configure Krita → Python Plugin Manager, enable Krita AI API Diffusion, then restart Krita.
- Show the docker via Settings → Dockers → Krita AI API Diffusion.
-
Download or clone the repository:
git clone https://github.com/DenRakEiw/krita-ai-api-diffusion.git
-
Copy the
ai_api_diffusionfolder and theai_api_diffusion.desktopfile into Krita’spykritadirectory:OS Path Windows %APPDATA%\krita\pykrita\Linux ~/.local/share/krita/pykrita/macOS ~/Library/Application Support/krita/pykrita/The result should look like this:
pykrita/ ├── ai_api_diffusion.desktop └── ai_api_diffusion/ ├── __init__.py └── ai_api_diffusion_docker.pyIf the
.desktopfile is missing, create it with this content:[Desktop Entry] Type=Service ServiceTypes=Krita/PythonPlugin X-KDE-Library=ai_api_diffusion X-Python-2-Compatible=false Name=Krita AI API Diffusion Comment=Plugin for Flux (BFL)
-
Start Krita.
-
Open Settings → Configure Krita → Python Plugin Manager, enable Krita AI API Diffusion, then restart Krita.
-
Show the docker via Settings → Dockers → Krita AI API Diffusion.
cd <pykrita-directory>
git clone https://github.com/DenRakEiw/krita-ai-api-diffusion.git ai_api_diffusionThen copy the .desktop file one level up (into pykrita/) as shown above and
continue with steps 3–5.
- In the docker, switch to the Options tab.
- Pick your Language (English / Deutsch / 中文 / ไทย) — applied instantly.
- Enter your API Key (BFL) and click Save. (The key and language are stored in Krita’s settings.)
- Generate tab, choose a model (e.g.
flux-2-pro). - Enter a prompt; optionally set width/height under Options.
- Click New image (text → image) — the result is added as a new layer.
- Select the area to change with a selection tool.
- Enter an edit instruction as the prompt, e.g. “remove the object”.
- Click Context Inpaint (FLUX.2).
- Only the selected area is replaced (softly blended in).
- Select an area (min. ~256 px — small selections are upscaled).
- Optionally enter a prompt.
- Click Mask Inpaint (FLUX.1 Fill) — precise filling inside the mask.
- Select the head/eye area of the cat.
- Click Choose reference image … and load the sunglasses image.
- Choose model
flux-2-proorflux-2-max(they support multi-image). - Prompt: “the cat is wearing these sunglasses”.
- Click Context Inpaint (FLUX.2).
| Selection | Endpoint | Use |
|---|---|---|
flux-2-pro |
flux-2-pro |
Default, good quality, multi-image |
flux-2-max |
flux-2-max |
Highest quality, multi-image |
flux-2-flex |
flux-2-flex |
Strong at typography/text |
flux-2-klein-9b |
flux-2-klein-9b |
Fast, lightweight (no reference image) |
| Mask Inpaint | flux-pro-1.0-fill |
Mask-based filling |
- HTTP 422 “Image dimensions must be at least 256x256” — selection too small. It is upscaled automatically; still, select a larger area for sharp results.
- HTTP 402 / “insufficient credits” — no credits on the BFL account.
- HTTP 401 / 403 — API key wrong or not set (Options tab).
- Payload too large / timeout with reference images — lower
MAX_EDGEinai_api_diffusion_docker.pyor shrink the reference image beforehand. - Error messages appear in the status field at the bottom and as a dialog (truncated).
- BFL result URLs are short-lived; the plugin downloads the images immediately.
- The reference image is only used with FLUX.2 (context inpaint / generation), not with FLUX.1 Fill.
Use at your own risk. The FLUX models are subject to Black Forest Labs’ terms of use and pricing.