// from: https://stackoverflow.com/questions/14416107/int-array-to-bufferedimage // pixels are RGB pixels static BufferedImage intArrayToBufferedImageWithoutAlpha(int[] pixels, int w, int h) { int[] bitMasks = {0xFF0000, 0xFF00, 0xFF}; SinglePixelPackedSampleModel sm = new(DataBuffer.TYPE_INT, w, h, bitMasks); DataBufferInt db = new(pixels, pixels.length); WritableRaster wr = Raster.createWritableRaster(sm, db, new Point); DirectColorModel cm = new (24, bitMasks[0], bitMasks[1], bitMasks[2], 0); ret new BufferedImage(cm, wr, false, null); }