nQuant.Master 1.1.0

nQuant.cs is a C# color quantizer that can dramatically reduce the size of images with little to no perceptible quality loss.

Install-Package nQuant.Master -Version 1.1.0
dotnet add package nQuant.Master --version 1.1.0
<PackageReference Include="nQuant.Master" Version="1.1.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add nQuant.Master --version 1.1.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

nQuant.cs Color Quantizer

Fast pairwise nearest neighbor based algorithm with C# console

nQuant is a C# color quantizer producing high quality 256 color 8 bit PNG images using an algorithm optimized for the highest quality possible.

Another advantage of nQuant is that it is a .net library that you can integrate nicely with your own C# code while many of the popular quantizers only provide command line implementations. nQuant also provides a command line wrapper in case you want to use it from the command line. To get started:
Either download nQuant from this site or add it to your Visual Studio project seamlessly via Nuget. To use Nuget, simply enter Install-Package nQuant from the Package Manager Console.
If you do not use Nuget, add nQuant to your project and add a reference to it.
If you are using C#, you would call nQuant as follows:

    var quantizer = new PnnQuant.PnnQuantizer();
    using(var bitmap = new Bitmap(sourcePath))
    {
        try
        {                    
            using (var dest = quantizer.QuantizeImage(bitmap, pixelFormat, maxColors, true))
            {
                dest.Save(targetPath, ImageFormat.Png);
                System.Console.WriteLine("Converted image: " + targetPath);
            }
        }
        catch (Exception q)
        {
            System.Console.WriteLine(q.StackTrace);
        }
    }

If you are using the command line. Assuming you are in the same directory as nQuant.exe and nQuant.Master.dll, you would enter:
nQuant yourImage.jpg /o yourNewImage.png

nQuant will quantize yourImage.jpg and create yourNewImage.png in the same directory.

There are a few configuration arguments you can optionaly use to try and influence how the image gets quantized. These are explained in the console application.

nQuant.cs Color Quantizer

Fast pairwise nearest neighbor based algorithm with C# console

nQuant is a C# color quantizer producing high quality 256 color 8 bit PNG images using an algorithm optimized for the highest quality possible.

Another advantage of nQuant is that it is a .net library that you can integrate nicely with your own C# code while many of the popular quantizers only provide command line implementations. nQuant also provides a command line wrapper in case you want to use it from the command line. To get started:
Either download nQuant from this site or add it to your Visual Studio project seamlessly via Nuget. To use Nuget, simply enter Install-Package nQuant from the Package Manager Console.
If you do not use Nuget, add nQuant to your project and add a reference to it.
If you are using C#, you would call nQuant as follows:

    var quantizer = new PnnQuant.PnnQuantizer();
    using(var bitmap = new Bitmap(sourcePath))
    {
        try
        {                    
            using (var dest = quantizer.QuantizeImage(bitmap, pixelFormat, maxColors, true))
            {
                dest.Save(targetPath, ImageFormat.Png);
                System.Console.WriteLine("Converted image: " + targetPath);
            }
        }
        catch (Exception q)
        {
            System.Console.WriteLine(q.StackTrace);
        }
    }

If you are using the command line. Assuming you are in the same directory as nQuant.exe and nQuant.Master.dll, you would enter:
nQuant yourImage.jpg /o yourNewImage.png

nQuant will quantize yourImage.jpg and create yourNewImage.png in the same directory.

There are a few configuration arguments you can optionaly use to try and influence how the image gets quantized. These are explained in the console application.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
1.1.0 137 5/18/2020
1.0.0 122 5/18/2020