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 ?

J’ai cherché ce qui définit l’humain dans l’acte de dessiner et ce que l’IA ne pourra pas reproduire. J’ai retenu le geste et la vibrance qu’il porte, et c’est de là que je suis partie.

Le plugin complète donc le dessin au lieu de générer à la place de l’utilisateur. Il prévisualise la direction donnée au trait, et des LoRAs 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 panneau natif. Le code est découpé en modules : core/api parle à ComfyUI, core/photoshop exporte le document, core/lora gère l’entraînement, core/network tient le WebSocket de progression, et ui regroupe les sélecteurs de workflow et le download monitor.

Six workflows Flux sont packagés (fp8, gguf, schnell, variantes LoRA) et se choisissent depuis le panneau.

Le serveur : ComfyUI, Caddy, custom node

ComfyUI tourne en local et expose ses APIs derrière un reverse proxy Caddy. UXP impose HTTPS sur certaines APIs réseau : Caddy génère en interne un certificat auto-signé et redirige https://localhost:8443 vers http://127.0.0.1:8188, sans modifier ComfyUI.

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

Entraînement LoRA via Kohya_ss

L’entraînement 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 l’entraînement en sous-processus, expose l’avancement sur /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 uv, clone ComfyUI avec ses dépendances, installe Kohya et copie le custom node. Le dossier par défaut est %LOCALAPPDATA%\SelixyAI, et on peut le rediriger.

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

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?

I looked at what makes drawing human, and at what AI will never reproduce. I kept the gesture and the vibrancy it carries, and started from there.

So the plugin completes the drawing instead of generating it for the user. It previews the direction given to the stroke, and 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. The code is split into modules: core/api talks to ComfyUI, core/photoshop exports the document, core/lora handles training, core/network manages the progress WebSocket, and ui holds the workflow selector and the download monitor.

Six Flux workflows are packaged (fp8, gguf, schnell, LoRA variants) and can be picked from the panel.

The server: ComfyUI, Caddy, custom node

ComfyUI runs locally and exposes its APIs behind a Caddy reverse proxy. UXP enforces HTTPS on some networking APIs: Caddy issues an internal self-signed certificate and forwards https://localhost:8443 to http://127.0.0.1:8188, without modifying ComfyUI.

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) and async job triggering.

LoRA training via Kohya_ss

Training 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 on /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 uv, clones ComfyUI with its dependencies, installs Kohya and copies the custom node. The default 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 and Caddy processes, removes the PATH entry, cleans the registry keys and deletes the files.