Java BufferedImage Pixel toRgbPixels(BufferedImage image)

Here you can find the source of toRgbPixels(BufferedImage image)

Description

to Rgb Pixels

License

Apache License

Declaration

public static int[] toRgbPixels(BufferedImage image) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.awt.image.BufferedImage;

import java.awt.image.DataBufferInt;

public class Main {
    public static int[] toRgbPixels(BufferedImage image) {
        if (image.getData().getDataBuffer() instanceof DataBufferInt) {
            return ((DataBufferInt) image.getData().getDataBuffer()).getData();
        } else {//from w ww  .ja va  2 s .c o m
            return image.getRGB(0, 0, image.getWidth(), image.getHeight(), null, 0, image.getWidth());
        }
    }
}

Related

  1. pixelsb(BufferedImage image)
  2. pixelsFromBufferedImage(final BufferedImage image)
  3. pixelsg(BufferedImage image)
  4. pixelsToImage(int[][] pixels)
  5. setRGB(BufferedImage image, int x, int y, int width, int height, int[] pixels)