Simplify Similar Colors in a List?

Hi all,

I’m using image sampler to color some meshes. I ended up with 21k colors. I wonder if there is a way to reduce similar colors with a similarity threshold? I realize taking the average of the RGB values can give mixed results because many color combinations can add up to the same total number. Maybe there is a simpler way out there?

Edit, it would be great if I can simplify the list of already outputed colors instead of how the image sampler reads the image.

I’ve never dealt with 21K colors, but I’d try RGB as XYZ coordinates and use something like Kangaroo’s Remove Duplicate Points then Closest Point?

from this:

to this:

lots_of_colors.gh (13.4 KB)

3 Likes

I think I have seen some of the sort in this forum. Wouldn’t it result in some sort of pixelation? Will have to try.

What I have in mind is something like the “select similar” in Photoshop and then repalce that color for the average color.

Ah, thanks for the example!

I re-used @inno’s color points (which frankly should have been in @ShynnSup’s original post) and added the white and blue groups to reduce the color count. I’m not quite sure why the edge groups are half the size of the middle groups or how to fix that? :thinking:


reduce_colors_2022_Nov7a.gh (19.7 KB)

This is the expression in all three Eval components:
round(x/(255/y))*round(255/y)

1 Like

You could use K-Mean Clustering, but i will be “flat”.

2 Likes

Here is a play using Find Domain (FDom), though I can’t say I like it better…


reduce_colors_2022_Nov7b.gh (20.5 KB)

P.S. I used the high value of each domain in version ‘b’ (above). Instead, this one (version ‘c’ below) uses the Average (middle) of each domain.


reduce_colors_2022_Nov7c.gh (21.0 KB)

1 Like