Java: Holen Sie sich die RGBA aus einem gepufferten Bild als Array von Integer

Wie erhalte ich eine Bilddatei im PNG-Format, um ein Array von int [r, g, b, a] zu erhalten, das das Pixel in Zeile i, Spalte j darstellt?

So weit fange ich hier an:

private static int[][][] getPixels(BufferedImage image) {

    final byte[] pixels = ((DataBufferByte) image.getRaster().getDataBuffer()).getData();
    final int width = image.getWidth();
    final int height = image.getHeight();

    int[][][] result = new int[height][width][4];

    // SOLUTION GOES HERE....
}

Danke im Voraus

Antworten auf die Frage(4)

Ihre Antwort auf die Frage