PImage img; color[] imageColors; void setup(){ size(100,100); frameRate(0.5); smooth(); noFill(); img = loadImage("colpalette-A.jpg"); imageColors = new color[10]; for(int x = 0; x < 10; x+=1){ imageColors[x] = img.get(x*10+1,5); //println(imageColors[x]); } imageColors = sortColors(imageColors); } void draw(){ background(255); for(int x = 10; x < width; x += 10){ int r = int(random(imageColors.length)); float thick = 2*((10 - r)) + 1.0; stroke(imageColors[r]); strokeWeight(thick); line(x, height, x, height-10*r + thick); line(x, 0, x, height - 10*r - thick); } } //sort according to brightness (low to high) color[] sortColors(color[] colors){ color[] sorted = new color[colors.length]; int num = 0; for (int i = 0; i <= 255; i++){ for (int j = 0; j < colors.length; j++){ if (int(brightness(colors[j])) == i){ sorted[num] = colors[j]; num++; } } } return sorted; }