How acly/krita-ai-diffusion works
This is a Krita plugin for controlled AI image generation and editing. The main workflow starts in Krita’s plugin UI, prepares generation inputs from the document and its layers, queues a job, sends it through a local ComfyUI or cloud connection, and applies returned images to the document. The graph also preserves documented capabilities such as live painting, upscaling, regions, control inputs, styles, and custom workflows. Some links rely on the README and module boundaries because those implementations were not sampled.
Main entry points: model.py Document model · connection.py Connection manager · comfy_client.py Local client · cloud_client.py Cloud client
Components 21
Krita integration
- Plugin entry
ai_diffusion/extension.py - Generation UI
ai_diffusion/ui/generation.py - Connection settings
ai_diffusion/ui/settings.py
Document and jobs
- Document model
ai_diffusion/model/model.py - Krita layers
ai_diffusion/layer.py - Job queue
ai_diffusion/model/jobs.py - Image utilities
ai_diffusion/image.py
Generation backends
- Connection manager
ai_diffusion/model/connection.py - Workflow builder
ai_diffusion/backend/workflow.py - Local client
ai_diffusion/backend/comfy_client.py - Cloud client
ai_diffusion/backend/cloud_client.py - Server manager
ai_diffusion/backend/server.py
Generation features
- Regions and controls
ai_diffusion/model/region.py - Live painting
ai_diffusion/model/model.py - Upscaling
ai_diffusion/model/model.py - Styles and presets
ai_diffusion/style.py - Custom workflows
ai_diffusion/model/custom_workflow.py
Other components
- Artist
- Krita
- ComfyUI
- Cloud service
Connections 26
- Artist → Krita: edits in
- Krita → Plugin entry: loads plugin
- Artist → Generation UI: uses
- Generation UI → Document model: requests generation
- Document model → Krita layers: reads and writes
- Document model → Regions and controls: uses inputs
- Document model → Workflow builder: prepares workflow
- Document model → Job queue: adds jobs
- Job queue → Connection manager: dispatches jobs
- Connection manager → Local client: selects client
- Connection manager → Cloud client: selects client
- Local client → ComfyUI: submits workflow
- ComfyUI → Local client: returns results
- Cloud client → Cloud service: submits jobs
- Cloud service → Cloud client: returns results
- Connection settings → Server manager: configures and starts
- Server manager → ComfyUI: installs and runs
- Connection manager → Server manager: manages local server
- Connection manager → Document model: reports events
- Document model → Krita layers: applies results
- Document model → Image utilities: processes images
- Live painting → Document model: enqueues frames
- Upscaling → Document model: enqueues upscale
- Regions and controls → Workflow builder: supplies controls
- Styles and presets → Document model: configures generation
- Custom workflows → Document model: generates custom jobs