Skip to content

Instantly share code, notes, and snippets.

MPurcell-EDR / gist:147e5a36da7491f25844e225d68dd268
Created Oct 11, 2017 — forked from jdiscar/gist:9144764
RGB Value to Nearest Color Name (Python)
View gist:147e5a36da7491f25844e225d68dd268
Original Author Ernesto P. Adorio, Ph.D
Original Source:
Modifed By: JDiscar
This class maps an RGB value to the nearest color name it can find. Code is modified to include
ImageMagick names and WebColor names.
1. Modify the minimization criterion to use least sum of squares of the differences.
2. Provide error checking for input R, G, B values to be within the interval [0, 255].