Java BufferedImage Pixel imageFromIntArray(int[] pixels, int w, int h)

Here you can find the source of imageFromIntArray(int[] pixels, int w, int h)

Description

Build an image from a pixel array.

License

Open Source License

Declaration

public final static Image imageFromIntArray(int[] pixels, int w, int h) 

Method Source Code


//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;
    }
}

Related

  1. extractFromPixeldata(short[] pixeldata, int columns, int stride, int mask, byte[] ovlyData, int off, int length)
  2. getRandomPixel(final String fileName)
  3. pixels(BufferedImage image)
  4. pixelsb(BufferedImage image)
  5. pixelsFromBufferedImage(final BufferedImage image)
  6. pixelsg(BufferedImage image)