In our article about the best AI image generators, we acknowledge that local environments aren't for everyone… but it's impossible to deny their superiority. The absence of limits and the ability to use multiple models change the rules completely; however, none of that helps without a good interface. That's where ComfyUI comes in, inspired by modular designs and flow diagrams to provide a much more intuitive experience.

How to Use ComfyUI to Generate Images with Stable Diffusion Offline
Generate images with Stable Diffusion offline

Dissolving Limits

The free services we recently shared work very well and are an excellent starting point for any user who wants to generate images without downloading anything. But their ultimate goal is to make money change hands, and to achieve that they simply impose a series of limits, including the daily token count, model availability, and of course, the types of images we can generate.

Offline models based on Stable Diffusion tackle all that from the root. Once we overcome the main hurdle (an Nvidia graphics card that doesn't lag behind in VRAM), a wide range of possibilities opens up: alternative models, high resolution, inpainting, upscaling, model merging, and much more. The number one recommendation for these cases is Automatic1111 (which includes better support for AMD and Intel GPUs), but there's also ComfyUI, and that's what we'll explore today.

Installing ComfyUI for Offline Stable Diffusion Image Generation

How to Use ComfyUI to Generate Images with Stable Diffusion Offline
The console is our friend. ComfyUI doesn't download any dependencies, but it requires elevated privileges.

One of the best things about ComfyUI is that it comes ready to use in a 1.4 GB .7z archive. All its dependencies are included, and all we need to do (besides decompressing it) is run the run_nvidia_gpu.bat or run_cpu.bat (the latter enables CPU usage but will be very slow) from a system console with elevated privileges.

How to Use ComfyUI to Generate Images with Stable Diffusion Offline
ComfyUI doesn't include models, but Civitai has everything we need and more.

But before getting to that point, we need to download a compatible model. ComfyUI works with all versions of Stable Diffusion; however, the best suggestion is to visit Civitai, search for a model that catches our attention, and download it. There's a lot of NSFW material there, so it's not a good idea to use a public or work computer. Models range from 1.5 to 6.5 GB and go in the ComfyUI\models\checkpoints subfolder. It doesn't matter if they are "Checkpoints" or "SafeTensors" (recommended), both work the same way.

Using ComfyUI for the First Time

How to Use ComfyUI to Generate Images with Stable Diffusion Offline
Take it easy...

With the content extracted and our model stored in the correct subfolder, it's time to open run_nvidia_gpu.bat. If everything goes well, this will create a tab in the default browser with the address http://127.0.0.1:8188/, presenting the ComfyUI interface.

How to Use ComfyUI to Generate Images with Stable Diffusion Offline
The interface lets us change the color of certain modules. Here we use green for the prompt, and red for the negative prompt.

There's nothing to worry about. It looks like it was designed by an alien, but it makes a lot of sense. This standard configuration enables everything we need to generate images almost immediately, and it only requires a handful of adjustments.

  • The Load Checkpoint module lets us select installed models. Here we click the arrows until we see the name of the model we got from Civitai. The three points with their links, identified as Model, CLIP, and VAE, remain untouched.
  • In this example, there are two modules called CLIP Text Encode, and they are identical except for one essential detail: one has a positive condition (i.e., "what we want to see" in the image), and the other has a negative condition ("what we don't want to see"). We load the prompts here, and the Conditioning links go to Positive and Negative respectively.
How to Use ComfyUI to Generate Images with Stable Diffusion Offline
The KSampler module helps us define advanced parameters for generation.
  • The Empty Latent Image module simply sets the final resolution of the images and how large the batch should be. If we choose very high values in both fields, the risk of saturating available VRAM increases. We need to experiment.
  • The same applies to the module called KSampler. The magic happens here: KSampler provides control over the seed and how it should be processed (randomize is ideal), the number of steps, guidance or intensity (CFG), sampler, scheduler, and denoise level. I personally prefer to increase steps to 30 and lower CFG to 7. The euler/normal combination is suitable to start, and denoise should stay at 1.00 with new generations.
How to Use ComfyUI to Generate Images with Stable Diffusion Offline
The last modules barely require user intervention.
  • The last two modules are VAE Decode, which transforms latent chaos into real images (no user intervention required), and Save Image, which automatically saves all results to the ComfyUI/output folder and displays them in a mini gallery. A click on Queue Prompt starts generation.

Ad infinitum

How to Use ComfyUI to Generate Images with Stable Diffusion Offline
With offline generation, errors don't consume tokens.

Are the images not good? Just try again, and again, and again… as many times as necessary. The freedom from tokens allows us to do this to the point of boredom, test new models, incorporate LoRAs, embeddings, and textual inversions… but that's another story.

The point is that with ComfyUI, errors have no cost, there are no tokens to burn. We've barely scratched the surface of this interface, and the community already offers dozens of additional modules, but in its default configuration, ComfyUI provides a solid platform for generating images with AI offline, and I think everyone with the appropriate hardware should give it a try.

Official site and download: Click here