SixPix 0.3.2

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

SixPix.NET

Sixel image encoding and decoding library.

Namespace: SixPix

Encoding ( 🎨 Image → 🆎 Sixiel string)

Encode to Sixel string from SixLabors.ImageSharp's Image data.

from Stream

Syntax:
public static ReadOnlySpan<char> SixPix.Sixel.Encode(Stream stream)
Example:
using SixPix;

using var fileStream = new FileStream(@"path/to/image.png", FileMode.Open);
ReadOnlySpan<char> sixelString = Sixel.Encode(fileStream);
Console.Out.WriteLine(sixelString);

from Image

Syntax:
public static ReadOnlySpan<char> SixPix.Sixel.Encode(Image<Rgba32> img)
Example:
using SixLabors.ImageSharp;
using SixLabors.ImageSharp.PixelFormats;
using SixPix;

using var image = new Image<Rgba32>(width, height);
// drawing image ...
ReadOnlySpan<char> sixelString = Sixel.Encode(image);
Console.Out.WriteLine(sixelString);

Create encoder instance and encode

Syntax:
public static SixelEncoder Sixel.CreateEncoder(Image<Rgba32> image)
public static SixelEncoder Sixel.CreateEncoder(string path)
public static SixelEncoder Sixel.CreateEncoder(Stream stream)
Example:
using SixPix;

using var encoder = Sixel.CreateEncoder(@"path/to/image.png");
encoder.Resize(widht: 200, height: 200);

// Encode to Sixel string the automatically choosed frame, normaly the first frame (index = 0).
string sixelString1 = encoder.Encode();

// Encode to Sixel string frame of the index
string sixelString2 = encoder.EncodeFrame(1);

// Enumerate encoded string
foreach (var sixelString in encoder.EncodeFrames())
{
    // ...
}

// Animation
using var ct = new CancellationTokenSource(10 * 1000); // Stop after 10 seconds
var animationTask = encoder.Animate(ct.Token);
animationTask.Wait();

Decoding ( 🆎 Sixel string → 🎨 Image)

Decode to SixLabors.ImageSharp's Image from Sixel string data.

from Stream

Syntax:
public static Image<Rgba32> Sixel.Decode(Stream stream)
Example:
using SixLabors.ImageSharp.Formats.Png;
using SixPix;

using var fileStream = new FileStream(@"path/to/sixeldata", FileMode.Open);
using var image = Sixel.Decode(fs);
using var writeStream = new FileStream(@"path/to/sixel_image.png", FileMode.Create);
image.Save(writeStream, new PngEncoder());

from string

Syntax:
public static Image<Rgba32> Sixel.Decode(String sixelString)
Example:
using SixLabors.ImageSharp.Formats.Png;
using SixPix;

var sixelString = "\x1bP7;1;q\"1;1;12;12"
                + "#0;2;100;0;0"
                + "#0!12~-"
                + "#0!12~"
                + "\x1b\\";
using var image = Sixel.Decode(sixelString);
using var writeStream = new FileStream(@"path/to/sixel_image.png", FileMode.Create);
image.Save(writeStream, new PngEncoder());
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.  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.

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.3.2 166 5/17/2025
0.3.0 153 5/4/2025
0.2.0 180 10/18/2024