Documentation
¶
Overview ¶
malina lets you write Go applications that directly integrate stable-diffusion.cpp (https://github.com/leejet/stable-diffusion.cpp) for fully local text-to-image and image editing using hardware acceleration.
- Run any stable-diffusion.cpp supported model on Linux, macOS, or Windows.
- Use any available hardware acceleration such as CUDA (https://en.wikipedia.org/wiki/CUDA), Metal (https://en.wikipedia.org/wiki/Metal_(API)), or Vulkan (https://en.wikipedia.org/wiki/Vulkan) for maximum performance.
- malina uses the purego (https://github.com/ebitengine/purego) and ffi (https://github.com/JupiterRider/ffi) packages so CGo is not needed.
- Works with the newest stable-diffusion.cpp releases so you can use the latest features and model support.
malina is the text-to-image sibling of bucky (https://github.com/ardanlabs/bucky), which provides the same kind of FFI bindings for whisper.cpp.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package cmd implements the malina CLI subcommands (install, system, model, sd, info) wired into urfave/cli.
|
Package cmd implements the malina CLI subcommands (install, system, model, sd, info) wired into urfave/cli. |
|
examples
|
|
|
flux2
command
flux2 mirrors gosd's flagship example: a multi-file FLUX.2 [klein] 9B pipeline using a quantized diffusion model + VAE + Qwen3 LLM text encoder.
|
flux2 mirrors gosd's flagship example: a multi-file FLUX.2 [klein] 9B pipeline using a quantized diffusion model + VAE + Qwen3 LLM text encoder. |
|
hello
command
hello is the smallest possible malina example: load a stable-diffusion model, generate one image from a text prompt, and save it as PNG.
|
hello is the smallest possible malina example: load a stable-diffusion model, generate one image from a text prompt, and save it as PNG. |
|
img2img
command
img2img demonstrates image-to-image generation: load a stable-diffusion model, encode a source image (PNG or JPEG) as the starting latent, then denoise it using the supplied text prompt and save the result as PNG.
|
img2img demonstrates image-to-image generation: load a stable-diffusion model, encode a source image (PNG or JPEG) as the starting latent, then denoise it using the supplied text prompt and save the result as PNG. |
|
sd-encode
command
sd-encode is the smallest possible "images to video" example: read a collection of PNG and/or JPEG frames from a directory and mux them into a single Motion-JPEG AVI.
|
sd-encode is the smallest possible "images to video" example: read a collection of PNG and/or JPEG frames from a directory and mux them into a single Motion-JPEG AVI. |
|
system
command
system is the smallest possible malina example: load libstable-diffusion and print the library version and system info.
|
system is the smallest possible malina example: load libstable-diffusion and print the library version and system info. |
|
pkg
|
|
|
download
Package download provides utilities for downloading curated stable-diffusion model bundles.
|
Package download provides utilities for downloading curated stable-diffusion model bundles. |
|
loader
Package loader provides functions for loading the shared stable-diffusion.cpp libraries.
|
Package loader provides functions for loading the shared stable-diffusion.cpp libraries. |
|
sd
Package sd provides Go FFI bindings to stable-diffusion.cpp using purego and jupiterrider/ffi.
|
Package sd provides Go FFI bindings to stable-diffusion.cpp using purego and jupiterrider/ffi. |
|
utils
Package utils provides small string conversion helpers used by the malina FFI bindings.
|
Package utils provides small string conversion helpers used by the malina FFI bindings. |
Click to show internal directories.
Click to hide internal directories.