tiennm99 bf2e299c42 fix: use portable Python to bypass WDAC/Device Guard restrictions
Replace uv-based installation with Python embeddable ZIP package that
works on locked-down Windows environments (e.g. Windows Sandbox with
Device Guard). The embeddable python.exe is PSF-signed and doesn't
require an installer.

- Download Python 3.10.11 embeddable ZIP instead of using uv
- Bootstrap pip via get-pip.py (pure Python, no exe)
- Install packages to .venv/Lib/site-packages via --target flag
- Fix plugin copy fallback (create directory before copying)
- Fix launcher scripts to keep window open and show errors
- Add .python/ and python-*-embed-*.zip to .gitignore
2026-04-16 18:08:14 +07:00
2025-11-24 23:19:59 -08:00
2025-07-13 23:47:10 -07:00
2025-11-21 14:17:09 -08:00

ArtKrit

ArtKrit is a plugin for Krita that helps artists enhance their drawing skills by scaffolding the process of replicating a reference image into three steps: composition, value, and color. At each stage, ArtKrit generates adaptive composition lines and provides feedback on value and color accuracy to help artists refine their work.

fig_teaser

Bottom row: Computational guidance and feedback provided by our system at each step. We offer object-based composition lines to assist with spatial positioning, and we visualize differences in value and color with verbal suggestions to guide the user.

Reference image: "Interior Practice // Kitchen" by Loish (2021, digital).

Installation

Quick Install Available! We provide easy installation scripts (install.sh for macOS/Linux, install.ps1 for Windows) that handle everything automatically. Krita portable is downloaded locally (no system install needed) and all Python dependencies are stored inside the ArtKrit folder. Run run-krita to launch Krita with console logging, and run-server in a separate terminal to start the composition server.

Windows: First enable script execution (one-time): Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser, then run .\install.ps1 in PowerShell.

Krita

  1. Install Krita from the official website: https://krita.org/en/download/ (tested on version 5.2.9)
  2. To facilitate debugging, you can add the path to your Krita binary to your bash or zsh profile. On Mac, it should look like this (it would be bash for older MacOS versions):
    echo 'export PATH="/Applications/krita.app/Contents/MacOS/:$PATH"' >> ~/.zshrc
    source ~/.zshrc
    
    This allows you to run Krita from the terminal by typing krita. All the output from Krita and the plugin will be printed to the terminal.

File Structure Setup

  1. On Mac, the Python plugin folder is located at ~/Library/Application Support/Krita/pykrita/. Navigate to this folder and git clone this repository. Note that for MacOS, ~/Library/Application Support and /Library/Application Support are different folders. If you don't find the Krita folder, make sure you are in the Application Support for your user.

  2. Under the pykrita folder, create a artkrit.desktop file. The file structure now should look like this:

    pykrita/
        ArtKrit/
            ...
        artkrit.desktop
    
  3. In the artkrit.desktop file, add the following content:

    # File: artkrit.desktop
    [Desktop Entry]
    Type=Service
    ServiceTypes=Krita/PythonPlugin
    X-KDE-Library=ArtKrit
    X-Python-2-Compatible=false
    X-Krita-Manual=Manual.html
    Name=ArtKrit
    Comment=Docker for ArtKrit
    

Python Plugin Setup

  1. Pick your favorite virtual environment tool (e.g. uv, venv, conda, etc.) and create a new environment with python==3.10 at your home directory (~).

    • Make sure you use python==3.10 for compatibility with Krita 5.2.9.
    • Name your environment ddraw for consistency. If you name it something else or place it elsewhere, update the system path at the top of artkrit.py and value_color.py.
    • I recommend using uv to manage your environments for its simplicity and speed.
      • To install uv (on MacOS), curl -LsSf https://astral.sh/uv/install.sh | sh
      • To install the virtual environment, uv venv ddraw --python 3.10
  2. Activate your environment (e.g., source ddraw/bin/activate). Now navigate (cd) to ~/Library/Application\ Support/Krita/pykrita/ArtKrit

  3. First, install pytorch with:

    pip install torch torchvision torchaudio
    
    # If you're using `uv`, you can use the following command:
    uv pip install torch torchvision torchaudio
    
  4. Then install the other required packages:

    pip install -r requirements.txt
    
    # If you're using `uv`, you can use the following command:
    uv pip install -r requirements.txt
    

Running the Plugin

  1. In one terminal, run Krita by typing krita in the terminal. This will allow you to see the output from the plugin. Directly opening Krita also works, but you won't see the output.

  2. In another terminal, activate your environment and navigate to the ArtKrit folder. Then start the python server with:

    python script/composition/server.py
    

    Note, if you get an error, try running it with the specific python version: python3.10 server.py

  3. On the first launch, enable the plugin by going to Preferences (cmd+,), scrolling down, selecting Python Plugin Manager, and checking the ArtKrit box. Then, relaunch Krita. The docker (window) for the plug-in can be found under Settings > Dockers > ArtKrit.

  4. When setting up a Krita document, it is recommended to set it as the same size as the reference image. This will ensure that the plugin works as intended.

  5. Make sure to click Set Reference Image button every time you reopen Krita.

  6. If inferencing time for generating adaptive grids is too long, you can try to use smaller models listed in run_models.py. Note that smaller models will not be as performant.

Helpful Resources

Krita API Documentation: https://api.kde.org/krita/html/ Guide for plugins: https://docs.krita.org/en/user_manual/python_scripting/krita_python_plugin_howto.html

S
Description
ArtKrit, a plugin for Krita that helps artists enhance their drawing skills by scaffolding the process of replicating a reference image into three steps: composition, value, and color.
Readme 9.9 MiB
Languages
Python 91.8%
PowerShell 5%
Shell 3.2%