LMSupply.ImageGenerator
0.10.0
dotnet add package LMSupply.ImageGenerator --version 0.10.0
NuGet\Install-Package LMSupply.ImageGenerator -Version 0.10.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="LMSupply.ImageGenerator" Version="0.10.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="LMSupply.ImageGenerator" Version="0.10.0" />
<PackageReference Include="LMSupply.ImageGenerator" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add LMSupply.ImageGenerator --version 0.10.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: LMSupply.ImageGenerator, 0.10.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package LMSupply.ImageGenerator@0.10.0
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=LMSupply.ImageGenerator&version=0.10.0
#tool nuget:?package=LMSupply.ImageGenerator&version=0.10.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
LMSupply.ImageGenerator
A simple .NET library for local text-to-image generation using Latent Consistency Models (LCM). Designed for edge deployment with fast 2-4 step inference.
Features
- Fast Generation: LCM enables 2-4 step inference (vs 20-50 for standard diffusion)
- Edge-Optimized: ~3-4GB VRAM requirement, suitable for consumer GPUs
- GPU Acceleration: CUDA, DirectML, and CoreML support via ONNX Runtime
- Lazy Downloads: Models downloaded on-demand from HuggingFace
- Streaming Progress: Real-time step-by-step progress with optional previews
Quick Start
using LMSupply.ImageGenerator;
// Load the default LCM model
await using var generator = await LocalImageGenerator.LoadAsync("default");
// Generate an image
var result = await generator.GenerateAsync("A sunset over mountains");
await result.SaveAsync("output.png");
Model Aliases
| Alias | Description | Steps | Use Case |
|---|---|---|---|
default |
LCM-Dreamshaper-V7 | 4 | Best balance of quality and speed |
fast |
LCM-Dreamshaper-V7 | 2 | Fastest generation, slightly lower quality |
quality |
LCM-Dreamshaper-V7 | 4 | Higher guidance scale for better adherence |
Generation Options
var options = new GenerationOptions
{
Width = 512, // Image width (must be divisible by 8)
Height = 512, // Image height (must be divisible by 8)
Steps = 4, // Inference steps (2-4 for LCM)
GuidanceScale = 1.0f, // CFG scale (1.0-2.0 for LCM)
Seed = 42, // Random seed for reproducibility
NegativePrompt = "blurry, low quality",
GeneratePreviews = true // Enable step-by-step previews
};
var result = await generator.GenerateAsync("A cat wearing a hat", options);
Streaming Generation
await foreach (var step in generator.GenerateStreamingAsync("A beautiful landscape"))
{
Console.WriteLine($"Step {step.StepNumber}/{step.TotalSteps} ({step.Progress:F1}%)");
if (step.HasPreview)
{
// Save intermediate preview
await File.WriteAllBytesAsync($"preview_{step.StepNumber}.png", step.PreviewData!);
}
if (step.IsFinal && step.FinalImage != null)
{
await step.FinalImage.SaveAsync("final.png");
}
}
Batch Generation
// Generate 4 variations with different seeds
var images = await generator.GenerateBatchAsync("A fantasy castle", count: 4);
for (int i = 0; i < images.Length; i++)
{
await images[i].SaveAsync($"castle_{i}.png");
Console.WriteLine($"Image {i}: Seed={images[i].Seed}, Time={images[i].GenerationTime.TotalSeconds:F2}s");
}
GPU Configuration
var options = new ImageGeneratorOptions
{
Provider = ExecutionProvider.Cuda, // Force CUDA (auto-detected by default)
DeviceId = 0, // GPU device index
UseFp16 = true, // Use FP16 for reduced memory
CacheDirectory = "/path/to/cache" // Custom model cache location
};
await using var generator = await LocalImageGenerator.LoadAsync("default", options);
Requirements
- .NET 10.0+
- GPU with 3-4GB VRAM (recommended)
- Supported execution providers:
- CUDA 11/12 (NVIDIA GPUs)
- DirectML (Windows, any DirectX 12 GPU)
- CoreML (macOS, Apple Silicon)
- CPU (fallback, slower)
How It Works
LMSupply.ImageGenerator uses Latent Consistency Models (LCM), a distillation technique that enables high-quality image generation in just 2-4 steps instead of the traditional 20-50 steps required by Stable Diffusion.
The pipeline consists of:
- CLIP Text Encoder: Converts text prompts to embeddings
- LCM UNet: Denoises latents in 2-4 steps
- VAE Decoder: Converts latents to pixel space
- LCM Scheduler: Manages the accelerated diffusion process
License
MIT License - See LICENSE file for details.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net10.0
- LMSupply.Text.Core (>= 0.10.0)
- LMSupply.Vision.Core (>= 0.10.0)
- System.Numerics.Tensors (>= 10.0.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.10.0 | 31 | 1/22/2026 |
| 0.9.3 | 79 | 1/19/2026 |
| 0.9.2 | 79 | 1/19/2026 |
| 0.9.1 | 75 | 1/18/2026 |
| 0.9.0 | 82 | 1/18/2026 |
| 0.8.18 | 81 | 1/18/2026 |
| 0.8.17 | 81 | 1/17/2026 |
| 0.8.16 | 86 | 1/15/2026 |
| 0.8.15 | 82 | 1/13/2026 |
| 0.8.14 | 86 | 1/12/2026 |
| 0.8.13 | 83 | 1/10/2026 |
| 0.8.12 | 82 | 1/9/2026 |
| 0.8.11 | 82 | 1/9/2026 |
| 0.8.10 | 87 | 1/8/2026 |
| 0.8.9 | 80 | 1/8/2026 |
| 0.8.8 | 83 | 1/8/2026 |
| 0.8.7 | 83 | 1/8/2026 |
| 0.8.6 | 84 | 1/8/2026 |
| 0.8.5 | 85 | 1/7/2026 |
| 0.8.4 | 79 | 1/7/2026 |
| 0.8.3 | 175 | 12/22/2025 |