- C# 99.1%
- Python 0.9%
|
|
||
|---|---|---|
| docs | ||
| external | ||
| scripts | ||
| src/NovelAI.VisualNovelCreator | ||
| tests/NovelAI.VisualNovelCreator.Tests | ||
| .gitignore | ||
| .gitmodules | ||
| CHANGELOG.md | ||
| CLAUDE.md | ||
| Directory.Build.props | ||
| Directory.Packages.props | ||
| NovelAI.VisualNovelCreator.slnx | ||
| README.md | ||
NovelAI Visual Novel Creator
A cross-platform desktop application for creating visual novel character sprites using the NovelAI image generation API.
Features
- Character Management — Create and organize characters with multiple subsets (outfits, poses, art styles)
- Tag-Based Generation — Configure positive/negative tags with strength controls for precise image generation
- Style References — Upload reference images with adjustable strength and fidelity to guide generation
- Emotion Variants — Batch-generate 24 emotion expressions from a base image using NovelAI's augment emotion API
- Background Removal — Remove backgrounds from generated sprites using local ONNX models (BiRefNet, Anime-Seg, ToonOut, BRIA RMBG 1.4 & 2.0)
- Generation Queue — Sequential job queue with pause, resume, and abort controls
- Character-Level Tags — Share tags and references across all subsets of a character
- Breadcrumb Navigation — Visual navigation path with back-navigation support
- Encrypted Token Storage — API tokens stored securely using OS-level encryption
Screenshots
The application has three main views:
- Character Overview — Browse and manage a character's subsets with thumbnail previews
- Subset Editor — Configure tags, generate base images, and produce emotion variants
- Sprites Tab — Generate transparent background-removed sprites for use in visual novel engines
Getting Started
Prerequisites
- .NET 10.0 SDK or later
- A NovelAI API key (for image generation)
- Git (for submodule)
Build & Run
git clone --recurse-submodules https://github.com/your-repo/NovelAI.VisualNovelCreator.git
cd NovelAI.VisualNovelCreator
dotnet build
dotnet run --project src/NovelAI.VisualNovelCreator
If you already cloned without submodules:
git submodule update --init --recursive
First Launch
- Open Settings from the sidebar
- Enter your NovelAI API token and click Validate
- Choose a Default Save Location for character data
- (Optional) Configure a background removal model in the Background Removal tab
Usage
Creating a Character
- Click Add Character in the sidebar
- Enter a name for the character
- Add subsets (e.g., "school_uniform", "casual") to define different visual variants
Generating Images
- Select a subset from the sidebar
- Add positive tags (what you want) and negative tags (what to avoid)
- Optionally upload reference images for style guidance
- Click Generate Base Image
- Switch to the Emotions tab and click Generate All Emotions
Background Removal
- Go to Settings > Background Removal
- Select a model provider (BiRefNet, Anime-Seg, ToonOut, or BRIA RMBG-1.4 / 2.0)
- Choose a variant and click Download from HuggingFace
- RMBG-2.0 requires a HuggingFace token (gated model); BiRefNet and Anime-Seg need no token
- ToonOut has no hosted ONNX — produce it with
scripts/convert_toonout_to_onnx.py, then Browse to the file
- In the subset editor, switch to the Sprites tab
- Click Generate All Sprites to batch-remove backgrounds
Project Structure
src/NovelAI.VisualNovelCreator/ Main Avalonia desktop app
Models/ Domain models and settings
Services/Contracts/ Service interfaces
Services/Implementation/ Service implementations
ViewModels/ MVVM ViewModels
Views/ Avalonia XAML views
Views/Controls/ Reusable custom controls
tests/NovelAI.VisualNovelCreator.Tests/ NUnit test project (~360 tests)
external/NovelAI.ImageGen/ Git submodule: NovelAI API client
docs/ Architecture and design documentation
Architecture
The application follows a clean MVVM architecture:
- Views — Pure XAML, no code-behind logic
- ViewModels — UI state and commands via CommunityToolkit.Mvvm
- Services — Business logic, file I/O, API integration, background removal
Key architectural decisions:
- Sequential generation queue — Jobs processed one at a time via
Channel<T>, with pause/resume/abort - Settings snapshot pattern — Each job captures settings at enqueue time, immune to mid-queue changes
- Atomic file writes — All persistence uses
.tmp+ rename to prevent corruption - Provider pattern for background removal — Extensible for additional ONNX models
- Encrypted token storage — Uses
Microsoft.AspNetCore.DataProtection(DPAPI/Keychain/file keys)
See docs/architecture.md for detailed technical documentation.
Technology Stack
| Component | Technology |
|---|---|
| UI Framework | Avalonia 11.3 |
| MVVM | CommunityToolkit.Mvvm 8.4 |
| Runtime | .NET 10.0 |
| AI Inference | ONNX Runtime 1.26 |
| Image Processing | SixLabors.ImageSharp 3.1 |
| Logging | Serilog |
| Testing | NUnit 4 + NSubstitute |
| Serialization | System.Text.Json (source-generated) |
Background Removal Models
| Model | Architecture | Size | License | Auth | Notes |
|---|---|---|---|---|---|
| BiRefNet (Lite) | BiRefNet SwinT | 115 MB (FP16) | MIT | None | Fast; strong fine-detail edges |
| BiRefNet (Full) | BiRefNet SwinL | 490 MB (FP16) | MIT | None | Highest quality; slower |
| Anime-Seg | IS-Net (SkyTNT) | 176 MB | Apache-2.0 | None | Anime-specialized; fast |
| ToonOut | BiRefNet fine-tune | ~885 MB | MIT | None | Anime-specialized; convert locally, then Browse |
| BRIA RMBG-1.4 | IS-Net | 88 MB (FP16) | CC BY-NC 4.0 | None | Good for anime; non-commercial |
| BRIA RMBG-2.0 | BiRefNet | 514 MB (FP16) | CC BY-NC 4.0 | HuggingFace token | Non-commercial; gated |
All models run locally via ONNX Runtime — no cloud inference required after download. The app ships only the loader and downloads weights on demand. See docs/research/background-removal-models-2026.md for the model comparison and recommendations.
File Storage
Character data is stored as plain files in your chosen save location:
{SaveLocation}/{CharacterName}/
character.json Character definition (tags, subsets, references)
{SubsetName}/
base_image.png Generated base image
emotions/ 24 emotion variant PNGs
transparent/ Background-removed sprite PNGs
references/ Style reference images
Testing
dotnet test
The test suite includes:
- Service unit tests (character store, generation queue, settings, token store, download service)
- ViewModel unit tests (navigation, settings, subset editor, queue panel)
- Serialization round-trip tests
- DI container smoke tests
- End-to-end queue integration tests
Documentation
- Architecture — Technical architecture, component design, DI lifetimes
- Design — Domain model, core concepts, folder structure
- UI Requirements — UI layout and user flow specifications
- Implementation Plan — Development roadmap
License
This project is for personal use. The NovelAI API requires a valid subscription.