These are impressive, I wonder how he computes them: https://allrgb.com/al-zimmermann
sort an array of all 16777216 image positions (x,y) randomly
loop the positions array and for each position:
read the pixel color at the position as a reference
sample N random colors from the available colors list
for each sample calculate the hypotenuse from the reference color Math.hypot(R - r, G - g, B - b).
find the nearst color, use it for that position in the output image update the list of avalible colors (for practicality in chunks)
Without looking into what these images actually are and how they are generated, they remind me of mosaics I've made of hobby game contests https://williame.github.io/media/old/143376853353_1.jpg using https://en.wikipedia.org/wiki/Hungarian_algorithm, except _better_.