public int getValue(int pos) { int b = (int) (pos / (width * height)); pos -= b * width * height; int y = (int) (pos / width); int x = pos % width; return outImage.getSample(x, y, b); }