A few new stuffs about colors and LUTs.

I’ve added a few color-related commands recently. Here is a brief explanation of what they do:

Command color2name:

This commands basically converts a RGB triplet into a string that tells what color it is (in English).
The string is returned in the status.
So for instance:

color2name 255,255,0 e ${}
color2name 255,200,0 e ${}
color2name 255,100,0 e ${}
color2name 255,50,0 e ${}
color2name 255,0,0 e ${}

displays this:

Yellow
Golden Poppy
Safety Orange
Coquelicot
Red

The 881 existing color names have been extracted from the Wikipedia page : List of colors (alphabetical) - Wikipedia
Here is a visualization of each existing named color in the RGB color cube:

For any RGB argument, the command color2name returns (in the status) the name of the closest known color (closest in the sense of the L2-norm in RGB, which may be not optimal, but considering the density of the sampling, this should not make a huge difference to use another colorspace).

Command name2color:

This does the inverse, so

name2color "red" e ${}
name2color "Royal Blue Dark" e ${}
name2color "Violet" e ${}

displays:

255,0,0
0,35,102
143,0,255

In this case, you have to specify the exact color name though.

Command random_clut:

This command creates a “random” color LUT. It’s not completely random, as the process defines a set of simple constraints to be considered to get a color LUT that is not a total garbage.
In particular, it should ensure smooth transitions and avoid contrast inversion.

gmic_000001

It is highly perfectible, but still already fun to play with!
I’ve made an associated filter in the G’MIC-Qt plug-in as well:

That’s it for the news!

5 Likes

Hmm, now I have the idea of creating names2pal and pal2names which uses color names to create palettes, and generate array of names. I’m adding that to the bucket of my long TODOs list.

2 Likes