int[] rgbTransformedData = new int[height * width]; if (image instanceof J2SEImmutableImage) { ((J2SEImmutableImage) image).getRGB(rgbData, 0, width, x, y, width, height); } else { ((J2SEMutableImage) image).getRGB(rgbData, 0, width, x, y, width, height);