SeasonImage 0.1.0
dotnet add package SeasonImage --version 0.1.0
NuGet\Install-Package SeasonImage -Version 0.1.0
<PackageReference Include="SeasonImage" Version="0.1.0" />
<PackageVersion Include="SeasonImage" Version="0.1.0" />
<PackageReference Include="SeasonImage" />
paket add SeasonImage --version 0.1.0
#r "nuget: SeasonImage, 0.1.0"
#:package SeasonImage@0.1.0
#addin nuget:?package=SeasonImage&version=0.1.0
#tool nuget:?package=SeasonImage&version=0.1.0
SeasonImage
SeasonImage is a small .NET wrapper around stable-diffusion.cpp for image generation.
It focuses on a simple text-to-image workflow and ships the required Windows native runtimes in runtimes/win-x64/native.
Repository
GitHub: SeasonRealms/SeasonImage
stable-diffusion.cpp: https://github.com/leejet/stable-diffusion.cpp
Features
- Minimal P/Invoke wrapper over
stable-diffusion.dll - Simple context creation API
- Text-to-image generation
- Log and progress callbacks
- Windows native runtimes bundled with the package
- Backend selection through native
backend/params_backendstrings
Current Scope
- Supported runtime: Windows x64
- Native backend build included in the package: CPU, CUDA, Vulkan
- Current managed wrapper focus: image generation
On non-Windows platforms the assembly can still load, but the native stable diffusion runtime is not provided and the API will throw platform-specific exceptions when invoked.
Installation
Install from NuGet:
dotnet add package SeasonImage
Quick Start
This example follows the same usage pattern as SeasonImageGenerate(string prompt) in the sample project.
using SeasonImage;
StableDiffusion.SetProgressCallback(progress =>
{
Console.WriteLine($"{progress.Step}/{progress.TotalSteps} ({progress.Progress:P1})");
});
using var ctx = StableDiffusion.CreateContext(new StableDiffusionContextOptions
{
ModelPath = @"../../../../../../Models/StableDiffusion/v1-5-pruned-emaonly-f16.gguf",
Backend = "cpu",
ParamsBackend = "cpu",
ThreadCount = Environment.ProcessorCount,
EnableMmap = true,
FlashAttention = false
});
var images = ctx.GenerateImages(new StableDiffusionImageGenerationOptions
{
Prompt = "a cinematic portrait, ultra detailed",
NegativePrompt = "low quality, blurry",
Width = 1024,
Height = 1024,
SampleSteps = 20,
GuidanceScale = 7.0f,
Seed = 123456789,
BatchCount = 1
});
var first = images[0];
File.WriteAllBytes("output.rgba", first.Data);
Saving PNG In SeasonEngine
In SeasonEngine samples, the generated bytes are converted into NativeImageData and saved through DeviceServices.Image.SaveImage(...):
var first = images[0];
byte[] rgbaBytes = first.Channels switch
{
4 => first.Data,
3 => ExpandRgbToRgba(first.Data),
1 => ExpandGrayToRgba(first.Data),
_ => throw new NotSupportedException($"Unsupported image channel count: {first.Channels}")
};
using var nativeImageData = new NativeImageData(first.Width, first.Height, rgbaBytes);
var pngBytes = DeviceServices.Image.SaveImage(nativeImageData, Season.Basic.ImageFormat.Png);
StorageService.SaveFile(StorageService.DirectoryBase, "SeasonImage.png", pngBytes);
It's under development...
Context Options
Common StableDiffusionContextOptions values:
ModelPath: single-file model pathDiffusionModelPath,ClipLPath,ClipGPath,T5XxlPath,VaePath,LlmPath: split-model paths for newer architecturesBackend: runtime backend, such ascpu,cuda0,vulkan0,gpu,autoParamsBackend: parameter placement backend, such ascpu,cuda0,vulkan0,diskMaxVram: optional VRAM budget string such ascuda0=8
Examples:
Backend = "cpu";
ParamsBackend = "cpu";
Backend = "cuda0";
ParamsBackend = "cpu";
Backend = "te=cpu,vae=cpu,diffusion=cuda0";
ParamsBackend = "te=cpu,vae=cpu,diffusion=cuda0";
Notes
stable-diffusion.cppprogress and log callbacks are global callbacks- The current wrapper keeps the API intentionally small
- Advanced features such as
img2img,controlnet,preview callback,upscaler, andvideocan be added later on top of the same native binding layer
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-android36.0 is compatible. net10.0-browser was computed. net10.0-browser1.0 is compatible. net10.0-ios was computed. net10.0-ios26.0 is compatible. net10.0-maccatalyst was computed. net10.0-maccatalyst26.0 is compatible. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. net10.0-windows10.0.19041 is compatible. |
-
net10.0
- No dependencies.
-
net10.0-android36.0
- No dependencies.
-
net10.0-browser1.0
- No dependencies.
-
net10.0-ios26.0
- No dependencies.
-
net10.0-maccatalyst26.0
- No dependencies.
-
net10.0-windows10.0.19041
- No dependencies.
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.1.0 | 108 | 6/23/2026 |