https://github.com/benpollarduk/netaf.imaging
Imaging extensions for the NetAF library.
https://github.com/benpollarduk/netaf.imaging
adventure ascii-art console csharp fiction imaging interactive netaf text
Last synced: 6 months ago
JSON representation
Imaging extensions for the NetAF library.
- Host: GitHub
- URL: https://github.com/benpollarduk/netaf.imaging
- Owner: benpollarduk
- License: mit
- Created: 2024-11-26T14:52:59.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2026-01-14T09:33:58.000Z (6 months ago)
- Last Synced: 2026-01-14T13:22:46.667Z (6 months ago)
- Topics: adventure, ascii-art, console, csharp, fiction, imaging, interactive, netaf, text
- Language: C#
- Homepage:
- Size: 149 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# NetAF.Imaging
Extension to add simple imaging capabilities to NetAF.

[](https://github.com/benpollarduk/NetAF.Imaging/actions/workflows/main-ci.yml)
[](https://github.com/benpollarduk/NetAF.Imaging/releases)
[](https://www.nuget.org/packages/netaf.imaging/)
[](https://www.nuget.org/packages/netaf.imaging/)
[](https://codecov.io/gh/benpollarduk/NetAF.Imaging)
[](https://sonarcloud.io/summary/new_code?id=benpollarduk_NetAF.Imaging)
[](https://sonarcloud.io/summary/new_code?id=benpollarduk_NetAF.Imaging)
[](https://sonarcloud.io/summary/new_code?id=benpollarduk_NetAF.Imaging)
[](https://sonarcloud.io/summary/new_code?id=benpollarduk_NetAF.Imaging)
[](https://sonarcloud.io/summary/new_code?id=benpollarduk_NetAF.Imaging)
[](https://opensource.org/licenses/MIT)
## Overview
NetAF.Imaging provides extensions to [NetAF](https://github.com/benpollarduk/NetAF) to add simple functions to convert images to visuals.
## Getting Started
### Clone the repo/pull NuGet
Clone the repo:
```bash
git clone https://github.com/benpollarduk/netaf.imaging.git
```
Or add the NuGet package:
```bash
dotnet add package NetAF.Imaging
```
### Hello World
Generating visuals is made easy with the *VisualHelper* class. The following example generates a visual on the console:
```csharp
var displaySize = new Size(80, 50);
var adapter = new ConsoleAdapter();
var frame = VisualHelper.CreateFrame(@"C:\TestImage.jpg", displaySize, CellAspectRatio.Console);
adapter.RenderFrame(frame);
```
The original image:

The generated visual:

This can be used in a game:
```csharp
var frame = VisualHelper.CreateFrame(@"C:\TestImage.jpg", displaySize, CellAspectRatio.Console);
game.ChangeMode(new VisualMode(frame));
```
Here is a simple room that contains a command to look at the view.
```csharp
return new Room("Hillside", "A wild hillside with a lone tree", commands:
[
new CustomCommand(new CommandHelp("Look at view", "Look at the current view."), true, true, (game, args) =>
{
var frame = VisualHelper.CreateFrame(@"C:\TestImage.jpg", game.Configuration.DisplaySize, CellAspectRatio.Console);
game.ChangeMode(new VisualMode(frame));
return new(ReactionResult.GameModeChanged, string.Empty);
})
]);
```
### Applying Textures
A texturizer can be applied to add extra depth to the image:
```csharp
var frame = VisualHelper.CreateFrame(@"C:\TestImage.jpg", displaySize, CellAspectRatio.Console, new BrightnessTexturizer());
```
The generated visual:

## Documentation
Please visit [https://benpollarduk.github.io/NetAF-docs/docs/visuals.html](https://benpollarduk.github.io/NetAF-docs/docs/visuals.html) to view the NetAF.Imaging documentation.
## For Open Questions
Visit https://github.com/benpollarduk/NetAF.Imaging/issues