Skip to content

A C++ implementation of k-means++ for extracting prominent colors from PNG images.

License

Notifications You must be signed in to change notification settings

adamgrieger/c3po

Repository files navigation

c3po - C++ Palette Obtainer

A C++ implementation of k-means++ for extracting prominent colors from PNG images.

Compilation

Using g++ on Unix/Linux, enter the following command:

g++ -std=c++11 c3po.cpp Centroid.cpp KMeans.cpp Pixel.cpp lodepng.cpp -o c3po

OR

c3po_compile.sh

Usage

Using c3po is pretty straight forward. The command format for using c3po is as follows:

c3po [name of image file] [number of colors to generate]

For example, in order to extract 5 prominent colors from an image called example.png, you can just issue the following command:

c3po example.png 5

This will print out the colors to standard output and also generate a file called quantized_example.png which is the original image restricted to the generated color palette.

NOTE: It is suggested that you use PNG files with small dimensions (i.e. 100x100). The reason for this is that k-means++ can get really slow very quickly. Execution time is noticeably slower even with dimensions of 256x256.

Credits

@lvandeve for LodePNG

About

A C++ implementation of k-means++ for extracting prominent colors from PNG images.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages