Palette Tools

A set of tools for extracting and visualizing colors and colorspaces of images. Check out the Palette Extractor and Colorspace Visualizer tools!

Palette Extractor

Palette Extractor

The inspiration from this project came from a concept I learned about in an AI course I took in college: Self Organizing Maps. SOMs are a type of artificial neural network that are trained using unsupervised learning to produce a low-dimensional (typically two-dimensional), discretized representation of the input space of the training samples.

The idea for my palette extractor is to the take the "space" of colors in an image and reduce it to a 2D grid, which ends up resembling a "slice" of the colors space resembling an RGB or HSV slice that you might see in photo editing software.

The palette extractor has two output modes: traditional and tiling. The traditional mode treats the edges of the map as disconnected.

This usually results in a palette with black and white on two corners of the map, with corners on the same side resembling HSV-style color slices, and opposite corners resembling RGB-style slices.

Traditional Extract

The tiling mode wraps the edges of the map, so that the colors on the edges of the map are connected to the colors on the opposite edge of the map.

Tiling Extract

The tiling mode output is more useful for sampling as a texture, or for creating a seamless gradient. Here's an example of using it as a sample texture in a shader:

Shader Gradient

Colorspace Visualizer

The colorspace visualizer is a tool that takes an image and plots the colors of the image in a 3D space, with the x, y, and z axes representing the red, green, and blue values in the RGB color cube, or the hue, saturation, and value in the HSV color cylinder.

Color Space Visualizer

Combined Tools

Using the Palette Extractor and Colorspace Visualizer together, you can get a better understanding of the colors in an image, and how they relate to each other.

Point Cloud Cube

You can see that the colors of most images are localized to a point cloud, while the colors of an extracted palette are localized to a surface in the space, showing that the palette extraction is indeed a dimension reduction.

Traditional Cube

The traditional output is mapped to an open surface, while the tiling output is mapped to a closed surface, which is why the tiling output is more useful for creating seamless gradients.

Point Cloud Cube