ImageBox 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package ImageBox --version 1.0.0                
NuGet\Install-Package ImageBox -Version 1.0.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="ImageBox" Version="1.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ImageBox --version 1.0.0                
#r "nuget: ImageBox, 1.0.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.
// Install ImageBox as a Cake Addin
#addin nuget:?package=ImageBox&version=1.0.0

// Install ImageBox as a Cake Tool
#tool nuget:?package=ImageBox&version=1.0.0                

image-box

A C# API for creating PNGs and GIFs from vue-like templates

Installation

You can install the NuGet package:

PM> Install-Package ImageBox

Setup

You can either add the ImageBox library to your project using either Dependency Injection or by using the ImageBoxUtility class.

Usage

This is the preferred method of using this library as it gives you more control how the library is used. You can add the ImageBox library to your services like so:

using ImageBox;

//Get these from your application
IConfiguration config;
IServiceCollection services;

//Register the ImageBox library with your services
services.AddImageBox(config);

...

using ImageBox;

//Fetch this from your services
IImageBoxService _imageBox;

//Get your template and image output paths
var template = "template.html";
var outputDir = "output";
var outputName = "some-image";

//Get the image context and services
var image = _imageBox.Create(template);	
var context = await _imageBox.LoadContext(image);

//Determine the output path
var outputExt = context.Animate ? "gif" : "png";
var outputPath = Path.Combine(outputDir, $"{outputName}.{outputExt}");

//Render the image
await _imageBox.Render(ouputPath, image);

You can see an example of this method in the ImageBox.Cli project.

ImageBoxUtility

You can use the ImageBoxUtility class to create images like so:

using ImageBox;

var inputPath = "template.html";
var outputPath = "output.gif";

var ib = ImageBoxUtility.From(inputPath);
await ib.Render(outputPath);

Examples

You can check the various examples used in the ImageBox.Cli project.

More documentation will be added soon.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
1.0.1 125 8/19/2024
1.0.0 105 8/19/2024