int h = pixels.getHeight();
for (int ry = 0; ry < h; ry++, y++) {
int index = (y * width + x) * 3;
for (int rx = 0; rx < w; rx++) {
Color pixel = pixels.getPixel(rx, ry);
CIEXYZ c = pixel.toXYZ();
array[index++] = c.X();
array[index++] = c.Y();
array[index++] = c.Z();
}
}