Generate images from text prompts entirely on your own computer without paying for a cloud API
Run Stable Diffusion XL or FLUX models on an Apple Silicon Mac using Metal acceleration
Build a Python or Go app that generates images by calling this project's C library
Use ControlNet to guide the composition of a generated image by providing a reference sketch or pose
Requires downloading large model checkpoint files (several GB each) and selecting the right build flag for your GPU or CPU target.
stable-diffusion.cpp is a tool for running AI image-generation models on your own computer, written in C and C++. The name follows the pattern of llama.cpp, a widely known project that brought large language models to personal hardware. This project does the same thing but for diffusion models: the kind of AI systems that turn a text prompt into an image (or, for some models, a short video clip). The main draw is that it runs with no external software dependencies and works on a wide range of hardware. You can run it on a regular CPU or take advantage of a graphics card via CUDA (for Nvidia), Metal (for Apple Silicon), Vulkan, or OpenCL. The project supports many popular model families: Stable Diffusion 1.x, 2.x, XL, the FLUX series, Wan video models, Qwen Image, Z-Image, and others. Models can be loaded in several file formats including .safetensors and the compressed .gguf format, which can reduce memory usage. Using it is straightforward once you have the binary and a model file. You run a command-line tool, point it at your model, pass a text prompt, and it writes an image to disk. The project also ships an embedded web interface for those who prefer a browser-based view over the command line. Beyond basic text-to-image, the project supports ControlNet (which lets you guide composition using a reference image), LoRA fine-tuned models (small extra weights that adjust a model's style or subject), and image upscaling via ESRGAN. There are also several sampling methods available, which affect the quality and speed trade-off during generation. Third-party wrappers exist for Go, Python, Rust, C#, and Flutter, so developers who want to build applications on top of stable-diffusion.cpp can work in their preferred language rather than calling C code directly.
← leejet on gitmyhub — every repo by this author, as a profile.
Verify against the repo before relying on details.