public static ByteBuffer getByteBuffer(BufferedImage image){

        int[] pixelArray = new int[image.getWidth()*image.getHeight()];

        for(int y = 0; y < image.getHeight(); y++){
            for(int x = 0; x < image.getWidth(); x++){
                pixelArray[(y*image.getWidth()) + x] = image.getRGB(x, y);
            }
        }

        ByteBuffer buffer = BufferUtils.createByteBuffer(image.getWidth() * image.getHeight() * 4);

        for(int i = 0; i < pixelArray.length; i++){

            int pix = pixelArray[i];

            buffer.put((byte)((pix >> 16) & 0xFF));
            buffer.put((byte)((pix >> 8) & 0xFF));
            buffer.put((byte)(pix & 0xFF));

            buffer.put((byte)((pix >> 24) & 0xFF));

        }

        buffer.flip();

        return buffer;

    }