SeasonImage 0.1.0

dotnet add package SeasonImage --version 0.1.0
                    
NuGet\Install-Package SeasonImage -Version 0.1.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="SeasonImage" Version="0.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SeasonImage" Version="0.1.0" />
                    
Directory.Packages.props
<PackageReference Include="SeasonImage" />
                    
Project file
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 SeasonImage --version 0.1.0
                    
#r "nuget: SeasonImage, 0.1.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 SeasonImage@0.1.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=SeasonImage&version=0.1.0
                    
Install as a Cake Addin
#tool nuget:?package=SeasonImage&version=0.1.0
                    
Install as a Cake Tool

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

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_backend strings

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 path
  • DiffusionModelPath, ClipLPath, ClipGPath, T5XxlPath, VaePath, LlmPath: split-model paths for newer architectures
  • Backend: runtime backend, such as cpu, cuda0, vulkan0, gpu, auto
  • ParamsBackend: parameter placement backend, such as cpu, cuda0, vulkan0, disk
  • MaxVram: optional VRAM budget string such as cuda0=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.cpp progress and log callbacks are global callbacks
  • The current wrapper keeps the API intentionally small
  • Advanced features such as img2img, controlnet, preview callback, upscaler, and video can be added later on top of the same native binding layer
Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • 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