public static int tileColour(int[] bands, Raster r) {
		final int[] co = new int[] {6,4,0,1,2,3,5,6};
		int[] pCount = { 0, 0, 0, 0, 0, 0, 0 };
		final int w = r.getWidth();
		final int h = r.getHeight();
		for (int x = 0; x < w; x++) {
			for (int y = 0; y < h; y++) {
				int[] hsv = argbToHSV(r, x, y);
				// First check if the pixel is reasonably saturated
				if (hsv[1] > 50) {
					int col = hsv[0];
					for (int i = 0; i < 8; i++) {
						if(col < bands[i]) {
							pCount[co[i]]++;
							break;
						}
					}
				}
			}
		}
		int winner = 0;
		int max = 0;
		for (int i = 0; i < 7; i++) {
			if (pCount[i] > max) {
				winner = i;
				max = pCount[i];
			}
		}
		return winner;
	}