Outillage / IA générative

PhotoshopToComfyUI

L'IA générative directement dans Photoshop

UXPPhotoshopComfyUIFluxLoRAKohya_ssCaddy

Motivation

En septembre 2025, j’ai suivi un cours d’initiation à ComfyUI donné par Rémy Sohier. Le projet part d’une question : comment intégrer une assistance IA sans qu’elle remplace celui qui dessine ?

Pour y répondre, j’ai cherché ce qui définit l’humain dans l’acte de dessiner et ce que l’IA ne pourra pas reproduire. Après avoir pesé le pour et le contre, j’ai retenu le geste et la vibrance qu’il porte, et c’est de là que j’ai commencé.

Le plugin complète le dessin au lieu de générer à la place de l’utilisateur. Il prévisualise en temps réel la direction donnée au trait, et des LoRAs personnalisés, entraînés depuis le plugin, affinent les suggestions.

Le plugin Photoshop (UXP)

Le plugin est un Adobe UXP (Unified Extensibility Platform, le système de plugins d’Adobe en JS), installé comme un panel natif. J’ai découpé le code en modules : core/api parle à ComfyUI, core/photoshop exporte le document, core/lora gère la pipeline d’entraînement, core/network tient le WebSocket de progression, ui regroupe les sélecteurs de workflow et le download monitor.

J’ai packagé six workflows Flux (fp8, gguf, schnell, variantes LoRA), sélectionnables depuis le panel.

Le serveur : ComfyUI, Caddy, custom node

ComfyUI tourne en local et expose ses APIs via un reverse proxy Caddy. C’est nécessaire parce qu’UXP impose HTTPS sur certaines APIs réseau ; Caddy génère son certificat auto-signé en interne et redirige https://localhost:8443 vers http://127.0.0.1:8188, sans toucher à ComfyUI.

J’ai écrit un custom node lora_training qui ajoute des routes aiohttp à ComfyUI : upload base64 des images depuis le plugin, attribution d’IDs utilisateurs persistants (users.json), déclenchement asynchrone des jobs.

Entraînement LoRA via Kohya_ss

L’entraînement LoRA passe par Kohya_ss, isolé dans son propre venv Python 3.11.9 géré par uv. Le wrapper kohya_trainer.py construit la config, lance le training en sous-processus, expose l’avancement via /training/status/{lora_id}, et range les .safetensors directement dans ComfyUI/models/loras/. Le LoRA est utilisable dans le workflow suivant sans rien copier à la main.

Packaging et désinstallation

setup.ps1 installe l’ensemble : uv, ComfyUI cloné avec ses dépendances, Kohya, copie du custom node. Le dossier d’installation par défaut est %LOCALAPPDATA%\SelixyAI, mais on peut le rediriger.

uninstall.ps1 retrouve le chemin via le registre Windows (HKCU et HKLM), tue les processus Python/Caddy encore actifs, retire l’entrée du PATH, nettoie les clés de registre et supprime les fichiers.

Ce qui m’a tenu sur ce projet, c’est ce niveau de finition : l’outil s’installe et se désinstalle comme un logiciel normal.

Tooling / Generative AI

PhotoshopToComfyUI

Generative AI right inside Photoshop

UXPPhotoshopComfyUIFluxLoRAKohya_ssCaddy

Motivation

In September 2025, I took an introductory ComfyUI course taught by Rémy Sohier. The project started from a question: how do you add AI assistance without it taking the artist’s place?

To answer it, I looked at what makes drawing human, and at what AI will never reproduce. After weighing the pros and cons, I kept the gesture and the vibrancy it carries, and started from there.

The plugin completes the drawing instead of generating it for the user. It previews the direction the stroke is taking in real time, and custom LoRAs trained from the plugin refine the suggestions.

The Photoshop plugin (UXP)

The plugin is an Adobe UXP (Unified Extensibility Platform, Adobe’s JS-based plugin system), installed as a native panel. I split the code into modules: core/api talks to ComfyUI, core/photoshop exports the document, core/lora handles the training pipeline, core/network manages the progress WebSocket, ui holds the workflow selector and the download monitor.

I packaged six Flux workflows (fp8, gguf, schnell, LoRA variants), selectable from the panel.

The server: ComfyUI, Caddy, custom node

ComfyUI runs locally and exposes its APIs through a Caddy reverse proxy. This is needed because UXP enforces HTTPS on some networking APIs; Caddy issues an internal self-signed cert and forwards https://localhost:8443 to http://127.0.0.1:8188 without touching ComfyUI itself.

I wrote a lora_training custom node that adds aiohttp routes to ComfyUI: base64 image uploads from the plugin, persistent user-ID assignment (users.json), async job triggering.

LoRA training via Kohya_ss

LoRA training itself runs on Kohya_ss, isolated in its own Python 3.11.9 venv managed by uv. The kohya_trainer.py wrapper builds the config, launches training as a subprocess, exposes progress through /training/status/{lora_id}, and drops the resulting .safetensors straight into ComfyUI/models/loras/. The LoRA is usable in the next workflow without copying anything by hand.

Packaging and uninstall

setup.ps1 installs everything: uv, ComfyUI (cloned with its dependencies) and Kohya, then copies the custom node. The default install folder is %LOCALAPPDATA%\SelixyAI, and you can point it elsewhere.

uninstall.ps1 reads the install path from the Windows registry (HKCU and HKLM), kills any lingering Python/Caddy processes, removes the PATH entry, cleans registry keys, and deletes the files.

What kept me on this project is that level of finish: it installs and uninstalls like a normal piece of software.