Sorting and re-assigning RGB color values

I have aproject where i am given a digital artwork that contains many many colours.
I want GH to help me recreate the digital image in real life with real paint and a large but limited paint palette. - a lot like paint by numbers.

The concepts is:

  1. An artist generates an artwork.
  2. Grasshopper identifies colors in the artwork via a series of points
  3. Grasshopper deciphers the RGB value at each point
  4. GH searches a list of available colors from a paint company color range (listed as RGB values) and finds the closest RGB value
  5. GH recreates the Artwork using closest color match available in the paint companies color range.

I can identify the colors and split the RGB value in its x3 parts,
The bit I am having trouble with is the tool to search a list for an equal value or next closest value.
And then how to reassemble and RGB from x3 different lists back into and RGB value and back onto the point location.

Hope that makes sense. Seems like it should be possible with a bit of list experience. Its breaking my brain, a little bit of help would be really appreciated.
Thanks
colour namer rev7.gh (7.5 KB)

One way I can think of is to convert your colors to points and check the proximity between the two sets.


colour namer rev7_re.gh (13.8 KB)

2 Likes

Hi Jamin,

I used a similar approach by computing distance between the RBG points. This may not be the best way (Algorithm to check similarity of colors - Stack Overflow) but it is one of of many to consider.

Original image:
image

New image from list colours:
image

Image Sampler.gh (12.0 MB)

4 Likes

Awesome,
Thanks HS_Kim that is looking really promising really appreciate your help

Thanks Matt, Appreciate the help. I feel thoroughly taken to school, that is a very clean solution.

nice idea!