Made somewhat similar project by organizing pixels in three dimensional space of HSL (hue saturation lightness) color model: http://www.pixelbox.com/colorclouds/
Note that this reduces identical pixels into one point in 3D space. The key idea behind the experiment was to learn more about the palettes used by painters.