ComfyUI for local AI
I promised never to send your photos to a cloud AI. Generative fill still sounded useful. ComfyUI lets me have both: the model runs on your own computer, next to your photos.
Why ComfyUI
In my plan, I said no to cloud AI and maybe to ComfyUI. Cloud AI sends your photo to servers that another company controls. I won’t do that.
Building image generation into LightPhotos would be worse in a different way. The app would grow by gigabytes, I would have to keep GPU code working on four platforms, and you would be stuck with my choice of model.
ComfyUI already does the hard part. It runs image models on Mac, Windows and Linux, on whatever GPU you have, and it is free and open source. It has an HTTP API on your own computer. So LightPhotos generates nothing itself. It sends the area you painted to ComfyUI and keeps what comes back.
Setting it up
- Install ComfyUI Desktop and start it. A ComfyUI that you run from source works too.
- In LightPhotos, open Settings and turn on Enable ComfyUI. It is off by default. While it is off, LightPhotos never contacts a server.
-
Leave Server empty. LightPhotos tries ComfyUI
Desktop’s port, 8000, and then 8188, on
127.0.0.1. - Check Models folder. LightPhotos reads the folder that ComfyUI Desktop is set to, so it is usually filled in already.
- Under Generative Fill, click Download for each model file.
LightPhotos ships no model weights. Generative Fill uses SDXL
Inpainting 0.1, as four files from Hugging Face: the UNet, two text
encoders and the VAE, 6.9 GB together. Each one downloads to a
.part file and is renamed into place only when its size
and SHA-256 match, so ComfyUI never sees half a model. If the
download stops, it continues where it stopped.
Using it
Open a photo, go to Touch Up and click + Brush. Paint over what you want gone and let go. That’s it.
- Prompt is optional. Leave it empty and the fill continues the area around it. Type “grass” or “blue sky” to steer it.
-
Each generation makes three variations, from three
seeds. Step through them with
‹ 1/3 ›, or click Generate More for three new ones. - A pin marks each fill on the photo. Click it to pick it again later, or to delete it.
When something is missing, the button is greyed out, not hidden, and its hover text names the first thing to fix: turn it on in Settings, choose the models folder, download a file, or start ComfyUI. When ComfyUI starts, the button turns on by itself within five seconds.
A fill is just another edit
This is the part that took the most work, and the part I care about most. A generated patch isn’t pasted into your photo:
- Your photo file is never changed. Each variation is saved as a small image file beside the photo. The sidecar keeps about 300 bytes saying where the fill goes and which variation you picked.
- The sliders still work. The fill is blended in early, before white balance, exposure and local edits. If you change the exposure afterwards, the fill changes with the rest of the photo.
- It’s everywhere the photo is. Thumbnails, the Loupe and every export show the fill, and undo removes it.
- It doesn’t need ComfyUI anymore. Once a fill is made, it draws and exports with ComfyUI closed, or on a computer that never had it. The browser version of LightPhotos can’t make fills, but it shows them.
What LightPhotos sends
Only a crop. LightPhotos cuts out the painted area with some space
around it, scales it to 1024 pixels or less, and sends that, with
the painted part made transparent. ComfyUI never gets the whole
photo, the file name or the metadata. ComfyUI keeps the crops it
receives in its own input folder, so empty that folder
if you don’t want them kept.
LightPhotos asks the server only while Touch Up is open, every five seconds while it is down and every 30 seconds while it is up. If ComfyUI stops halfway, the error says what to do: “ComfyUI stopped responding at 127.0.0.1:8000. Start it again, then press Generate.” A generation that gets one or two variations keeps them.
The limits
- Desktop only. Generating a fill needs the desktop app, in v0.1.40.
- RAW highlights. A model works on ordinary display images. In a RAW file, very bright highlights inside a filled area clip to white.
- One model, for now. The workflow is built in. It
is plain ComfyUI workflow JSON, and LightPhotos only needs three
things from it: one image input, one image output, and a text node
titled
LightPhotos Prompt.
What’s next
Generative Fill is the first row in a table of AI features. Each row is a workflow and the model files it needs. Settings, the downloads and the server check all read the table, so the next feature is mostly a new workflow, not new plumbing.
The rule stays the same: AI in LightPhotos runs on your computer, or not at all.