code: public int[][][] fromFileMultipleChannels(File file) throws IOException {
          BufferedImage image = ImageIO.read(file);
          image = scalingIfNeed(image, channels > 3);
  
          int w = image.getWidth(), h = image.getHeight();
          int bands = image.getSampleModel().getNumBands();
          int[][][] ret = new int[(int) Math.min(channels, Integer.MAX_VALUE)]
                  [(int) Math.min(h, Integer.MAX_VALUE)]
                  [(int) Math.min(w, Integer.MAX_VALUE)];
          byte[] pixels = ((DataBufferByte) image.getRaster().getDataBuffer()).getData();
  
          for (int i = 0; i < h; i++) {
              for (int j = 0; j < w; j++) {
                  for (int k = 0; k < channels; k++) {
                      if (k >= bands)
                          break;
                      ret[k][i][j] = pixels[(int) Math.min(channels * w * i + channels * j + k, Integer.MAX_VALUE)];
                  }
              }
          }
          return ret;
      }
docs: Load a rastered image from file
  
  @param file the file to load
  @return the rastered image
  @throws IOException