Here you can find the source of imageFromIntArray(int[] pixels, int w, int h)
public final static Image imageFromIntArray(int[] pixels, int w, int h)
//package com.java2s; /*//from ww w .jav a 2 s . co m * Copyright (c) Leuville Objects All Rights Reserved. * * Leuville Objects MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF * THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED * TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A * PARTICULAR PURPOSE, OR NON-INFRINGEMENT. Leuville Objects SHALL NOT BE LIABLE FOR * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. */ import java.awt.*; import java.awt.image.*; public class Main { /** * Build an image from a pixel array. */ public final static Image imageFromIntArray(int[] pixels, int w, int h) { Image img = Toolkit.getDefaultToolkit().createImage(new MemoryImageSource(w, h, pixels, 0, w)); return img; } }