code: public static ByteBuffer getImageData(BufferedImage image, Format format) {
          final int width = image.getWidth();
          final int height = image.getHeight();
          final int type = image.getType();
          final int[] pixels;
          if (type == BufferedImage.TYPE_INT_ARGB || type == BufferedImage.TYPE_INT_RGB) {
              pixels = ((DataBufferInt) image.getRaster().getDataBuffer()).getData();
          } else {
              pixels = new int[width * height];
              image.getRGB(0, 0, width, height, pixels, 0, width);
          }
          return getImageData(pixels, format, width, height);
      }
docs: Gets the {@link java.awt.image.BufferedImage}'s data as a {@link java.nio.ByteBuffer}. The image data reading is done according to the {@link com.flowpowered.caustic.api.gl.Texture.Format}. The
  returned buffer is flipped an ready for reading.
  
  @param image The image to extract the data from
  @param format The format of the image data
  @return The flipped buffer containing the decoded image data