/** Converts an array of integer pixels into an image. * The array is referenced by the image. */ public static BufferedImage toImage(int[] pixels, int width, int height) { return new BufferedImage(DirectColorModel.getRGBdefault(),// Raster.createWritableRaster(new SinglePixelPackedSampleModel(DataBuffer.TYPE_INT,width,height, new int[]{0xff00000,0xff00,0xff}),// new DataBufferInt(pixels, width*height),new Point(0,0)), false, null ); } }