Chromis 1.0.3
.NET 8.0
This package targets .NET 8.0. The package is compatible with this framework or higher.
.NET Framework 4.7.2
This package targets .NET Framework 4.7.2. The package is compatible with this framework or higher.
dotnet add package Chromis --version 1.0.3
NuGet\Install-Package Chromis -Version 1.0.3
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="Chromis" Version="1.0.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Chromis" Version="1.0.3" />
<PackageReference Include="Chromis" />
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 Chromis --version 1.0.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Chromis, 1.0.3"
#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 Chromis@1.0.3
#: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=Chromis&version=1.0.3
#tool nuget:?package=Chromis&version=1.0.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
<div align="center"> <img src="https://raw.githubusercontent.com/xionglongztz/Chromis/refs/heads/master/ChromisBanner.png" alt="Banner"/> </div>
Chromis ð
Extract dominant colors from images using K-Means, Median Cut, or Octree algorithms.
Chromis is a lightweight, cross-platform .NET library for color extraction, designed with zero UI dependencies and clean data structures.
âĻ Features
- ðĻ Extract dominant colors from images
- ⥠Multiple algorithms:
- K-Means
- Median Cut
- Octree
- ð§Đ Cross-platform (.NET Framework / .NET 6+)
- ðŠķ Lightweight and dependency-free public API
- ð Compatible with legacy System.Drawing types (via overloads)
ðĶ Installation
dotnet add package Chromis
ð§ Basic Usage
C#
using System;
using System.Collections.Generic;
using System.Drawing;
public List<Color> GetPixelsFromImage(Image image, int stepCount = 5)
{
if (stepCount < 1)
throw new ArgumentOutOfRangeException(nameof(stepCount), "stepCount must greater than 1");
var pixels = new List<Color>();
using (var bmp = new Bitmap(image))
{
for (int x = 0; x < bmp.Width; x += stepCount)
{
for (int y = 0; y < bmp.Height; y += stepCount)
{
pixels.Add(bmp.GetPixel(x, y));
}
}
}
return pixels;
}
Usage
using Chromis;
var sampledColors = GetPixelsFromImage(pictureBoxMain.Image);
var rgbColors = new List<RGBColor>();
foreach (var color in sampledColors)
{
rgbColors.Add(RGBColor.FromRGB(color.R, color.G, color.B));
}
var colorInfos = ColorExtractor.Extract(rgbColors, 10);
foreach (var ci in colorInfos)
{
Console.WriteLine($"{ci.Color.R}, {ci.Color.G}, {ci.Color.B} - {ci.Ratio:P}");
}
VB.NET
Imports System;
Imports System.Collections.Generic;
Imports System.Drawing;
Public Function GetPixelsFromImage(image As Image, Optional stepCount As Integer = 5) As List(Of Color)
If stepCount < 1 Then Throw New ArgumentOutOfRangeException(NameOf(stepCount), "stepCount must greater than 1")
Dim pixels As New List(Of Color)()
Using bmp = New Bitmap(image)
For x = 0 To bmp.Width - 1 Step stepCount
For y = 0 To bmp.Height - 1 Step stepCount
pixels.Add(bmp.GetPixel(x, y))
Next
Next
End Using
Return pixels
End Function
Usage
Imports Chromis
Dim pixels As New List(Of ColorExtractor.RGBColor)
For Each sampledColor In GetPixelsFromImage(PictureBoxMain.Image)
pixels.Add(ColorExtractor.RGBColor.FromRGB(sampledColor.R, sampledColor.G, sampledColor.B))
Next
Dim colorInfos = ColorExtractor.Extract(pixels, 10)
For Each ci In colorInfos
Console.WriteLine($"{ci.Color.R}, {ci.Color.G}, {ci.Color.B} - {ci.Ratio:P}")
Next
R,G,B: RGB color valuesRatio: Percentage of this color in the image (0 ~ 1)
ð Algorithms
Chromis supports multiple color quantization algorithms:
- K-Means â balanced and accurate
- Median Cut â fast and classic
- Octree â memory efficient
ð License
| Product | Versions 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. |
| .NET Framework | net472 is compatible. net48 was computed. net481 was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETFramework 4.7.2
- No dependencies.
-
net8.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.