Java BufferedImage Operation changeImageToArray(BufferedImage bufferedImage)

Here you can find the source of changeImageToArray(BufferedImage bufferedImage)

Description

change Image To Array

License

Apache License

Declaration

public static int[][] changeImageToArray(BufferedImage bufferedImage) 

Method Source Code

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

import java.awt.image.BufferedImage;

public class Main {
    public static int[][] changeImageToArray(BufferedImage bufferedImage) {
        int width = bufferedImage.getWidth();
        int height = bufferedImage.getHeight();
        int[][] rgbPixels = new int[width][height];
        for (int y = 0; y < height; y++) {
            for (int x = 0; x < width; x++) {
                rgbPixels[x][y] = bufferedImage.getRGB(x, y); // Used (width - x - 1) instead x for flip horizontal
            }//  w ww .  j  a  va 2  s .c om
        }
        return rgbPixels;
    }
}

Related

  1. buildingCoordinatesInImage(BufferedImage imageSection)
  2. buildPixelAverages(BufferedImage a, Rectangle[] sectors)
  3. buildSectors(BufferedImage a, int sqrtSectors)
  4. cascadeHorizontal(final BufferedImage... images)
  5. changeContrast(BufferedImage img, float amount)
  6. checkIfManyColors(BufferedImage image)
  7. checkImageMatch(BufferedImage img1, String imgName1, BufferedImage img2, String imgName2)
  8. checkImageType(BufferedImage img, String name)
  9. checkRadius(final BufferedImage src, final int x, final int y, final int opaqueLimit, final int radius)