ImagePromptGenerator 0.5.2

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

ImagePromptGenerator

A lightweight, fluent C# library for building AI image generation prompts.

This library provides a small set of strongly-typed helper classes and helpers for composing style anchors, negative keywords, and full image generation prompts suitable for use with image generation models or pipelines.

Key features

  • Friendly API for building image prompts using StyleAnchor, StylePrompt, NegativeKeyword, NegativePrompt, and ImageGenerationPrompt.
  • Predefined style anchors covering common categories: sticker, photography, 2D art, 3D rendering, traditional art, and general/abstract.
  • Built-in negative keywords to exclude artifacts and style clashes (e.g., bad hands, watermark, realistic).
  • Preset prompt factories for common use-cases: sticker, 3D icon, photorealistic, and pixel art.
  • Simple string conversion with a default negative postfix --no suitable for many model CLI interfaces.

Quick start

Install or add this project to your solution. The source is minimal and can be referenced directly.

Build and pack the NuGet package (optional):

dotnet pack -o ./nupkgs ImagePromptGenerator.cs
dotnet nuget push ./nupkgs/ImagePromptGenerator.[version].nupkg --api-key $API_KEY --source https://api.nuget.org/v3/index.json

Basic usage

The library uses fluent operators to combine styles and negative keywords.

// Create a style prompt by combining predefined anchors
var style = StyleAnchor.Sticker.Cute
    + StyleAnchor.Sticker.Emoji
    + StyleAnchor.Art2D.CelShaded
    + StyleAnchor.Art2D.VibrantFlatColors;

// Build negative keywords to avoid certain styles and elements
var negative = NegativeKeyword.StyleClash.Photorealistic
    + NegativeKeyword.Elements.Text
    + NegativeKeyword.Elements.Watermark;

// Construct the final prompt
var prompt = new ImageGenerationPrompt(style, "smiling cat with party hat", negative);

// Customize background or subject if needed
prompt.Background = "isolated on a transparent background";

// Convert to string (uses default postfix "--no" for negative prompt)
Console.WriteLine(prompt.ToString());

Output example:

(cute sticker illustration, custom emoji, cel-shaded, vibrant flat colors), smiling cat with party hat, isolated on a transparent background --no (photorealistic, text, watermark)

Preset prompts

The library includes factory methods that return ready-to-use presets:

  • ImageGenerationPrompt.PresetSticker() — optimized for sticker/emoji icons.
  • ImageGenerationPrompt.Preset3DIcon() — for glossy 3D icon renders.
  • ImageGenerationPrompt.PresetPhotorealistic() — for photorealistic images.
  • ImageGenerationPrompt.PresetPixelArt() — for pixel-art / 8-bit style images.

Use them as starting points and then adjust Subject or Background:

var sticker = ImageGenerationPrompt.PresetSticker();
sticker.Subject = "red panda mascot holding a balloon";
Console.WriteLine(sticker);

API Summary

  • StyleAnchor — Defines a single style description; implicitly convertible from string and combines into StylePrompt with +.
  • StylePrompt — A collection of StyleAnchor providing ToString() formatting and convenient operators to combine with anchors, strings, or other prompts.
  • NegativeKeyword — Single negative keyword; implicitly convertible from string and combines into NegativePrompt with +.
  • NegativePrompt — A collection of NegativeKeyword and ToString() implementation to produce a negative list.
  • ImageGenerationPrompt — The final model of the prompt containing Style, Negative, Subject, and Background. It provides a ToString() that uses --no (default) as a negative postfix, and an overloaded ToString(string) to override the postfix.

Combining prompts

Style anchors and negative keywords support + operator for fluent composition. Examples:

var combined = StyleAnchor.Photography.Cinematic + StyleAnchor.Photography.GoldenHour;
var bad = NegativeKeyword.Quality.Blurry + NegativeKeyword.Elements.Text;

These can be passed directly into ImageGenerationPrompt.

Conventions & defaults

  • ImageGenerationPrompt.Background defaults to: isolated on a plain white background.
  • DefaultNegativePromptPostfix defaults to --no — a widely used negative postfix in model CLI style interfaces.

Contributing

Contributions, improvements, new anchors or keywords, and bug reports are welcome. Please fork this repository and open a PR.

License

This project uses the MIT license (see PackageLicenseExpression in project metadata).


If you'd like, I can also add usage examples for specific models (e.g., how to pass these prompts to a Python client or an HTTP API for image generation) — tell me which backend or model you target and I'll add examples.

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  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.
  • net6.0

    • 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.5.2 342 11/17/2025