Java BufferedImage to RGB imageToMatrix(BufferedImage image)

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

Description

image To Matrix

License

Open Source License

Declaration

public static int[][] imageToMatrix(BufferedImage image) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.awt.image.BufferedImage;

public class Main {
    public static int[][] imageToMatrix(BufferedImage image) {
        int w = image.getWidth();
        int h = image.getHeight();
        int[][] imageMatrix = new int[w][h];

        for (int i = 0; i < w; i++) {
            for (int j = 0; j < h; j++) {
                imageMatrix[i][j] = image.getRGB(i, j);
            }// w  w  w . j  a  va  2s . com
        }
        return imageMatrix;
    }
}

Related

  1. getRGB(BufferedImage image, int x, int y, int width, int height, int[] pixels)
  2. getRGB(BufferedImage img)
  3. getRgbFromImage(BufferedImage image)
  4. getRGBPixels(BufferedImage img)
  5. imageToPixels(BufferedImage image)
  6. imageToRGBABuffer(BufferedImage img)
  7. imageToRgbaBufferedImage(final Image image)