Releases: blenderskool/pigmnts
Pigmnts 0.7.0
Data parallelism with threads 🧵
Pigmnts now uses threads to achieve data parallelism in the assignment step of the K-means++ algorithm. The implementation follows the concept of MapReduce and makes use of crossbeam
crate for scoped threads. The number of threads is set to a constant value of 5 in the library.
Coming to the interesting part of this change, threads have made pigmnts 1.5x - 2.5x faster than previous versions! 🎉
The data from the tests can be found here https://docs.google.com/spreadsheets/d/1SJWTBTX9OjOPI9zdSc1T-hGUIiIv9osia1WB936vp8k/edit
Conclusions from the tests
- speedup achieved increases as the number of colors in palette "k" increases and stabilizes at higher values of k.
- In all
k > 1
cases, there is aspeedup > 1
achieved. - While the number of threads, for now, is fixed to 5 in the library, further experiments can be done to find an optimal number of threads to achieve a good speedup.
- Memory consumption from this change hasn't been tested extensively, but some observations have shown an increase in memory consumption.
WebAssembly?
Getting threads to work with WebAssembly as of now is a little challenging and this experiment was majorly to test whether threads would enhance the performance in any way. Over time, these changes would be brought over to the WebAssembly library too but for now, the WebAssembly version continues to work on a single thread.
K-means and K-means++ have a lot of synchronous steps involved and parallelizing it are not very straightforward. Data parallelism here does show an improvement in the performance of the algorithm in general.
Other changes
- Conditional compilation to separate WebAssembly and Rust crate level code.
- Removed usage of
extern
keyword from the source.
Pigmnts CLI 0.1.3
- Updated Pigmnts Library to 0.7.0
- Brings improved performance from v0.7.0 of the Pigmnts library 🏎️
- Update
conditional_vec
macro to call closure thus evaluating RHS only when LHS is truthy. - Update description of the CLI.
- Removed usage of
extern
keyword from the source.
Pigmnts CLI 0.1.2
Pigmnts CLI 0.1.2 🥈
- This update adds support for the nearest color names in the CLI via
-n
and--name
flag.
Pigmnts 0.6.0
The library has been updated with certain parameters for a potential speedup of the palette creation process. They include:
⚠️ Max iterations limit: Limits the number of iterations made in the clustering process. It can be set via themax_iter
parameter inpigments_pixels
function. Defaults to 300.- Tolerance limit: Prevents additional iterations in the clustering step when the changes in the means are under the tolerance limit. Set to 0.0001.
Some minor additions:
- New
from_rgb
method in LAB struct to create a LAB color directly from RGB values without intermediate RGB structs.
Pigmnts CLI 0.1.1
🌐 This update adds support for external HTTP(S) image URLs, and performance improvements from Pigmnts library 0.6.0
Pigmnts 0.5.0
This release changes the value returned by the pigments()
function which is available in WASM. The new return is of the following format
[
{
dominance: 0.565 // Dominance of color in image(From 0 to 1)
hex: '#6DDAD0' // 6-digit Hex color code
rgb: { // Equivalent RGB color
r: 109,
g: 218,
b: 208
},
hsl: { // Equivalent HSL color (Normalized to 0-1)
h: 0.48333,
s: 0.6,
l: 0.64,
}
},
// Other colors
{
...
}
]
Pigmnts CLI 0.1.0
Pigmnts CLI 0.1.0 🎉
Pigmnts CLI uses the pigmnts library to create a color palette from an image right on the command line! It comes with various output modes and provides on-demand data of the palette generated while maintaining high speeds.
Output modes implemented in the CLI
Default mode
The default mode displays the palette in a user-friendly way with a small preview and corresponding color codes in a tabular structure.
Quiet (or Silent) mode
This mode displays only the essential output without the intermediate logs. The output is in plain text format with each data item separated by :
Flags and options in the CLI
FLAGS:
-d, --dominance Enable dominance percentage of colors
-h, --help Prints help information
-x, --hex Enable Hex code output of colors
-s, --hsl Enable HSL output of colors
-l, --lab Enable L*AB output of colors
-q, --quiet Suppress the normal output [aliases: silent]
-r, --rgb Enable RGB output of colors
-V, --version Prints version information
OPTIONS:
-c, --count <COUNT>... Number of colors in the palette
Pigmnts 0.4.0
Pigmnts 0.4.0 comes with following changes under the hood:
Internally uses L*ab color space to create the palette
Support for weighted means
HSL, LAB color spaces
pigments_pixels
and pigments
functions have changed. Check README for new signatures.