code: public static BufferedImage convertToBufferedImage(Image img) {
          BufferedImage buff = createCompatibleTranslucentImage(
                  img.getWidth(null), img.getHeight(null));
          Graphics2D g2 = buff.createGraphics();
  
          try {
              g2.drawImage(img, 0, 0, null);
          } finally {
              g2.dispose();
          }
  
          return buff;
      }
docs: Converts the specified image into a compatible buffered image.
  
  @param img
  the image to convert
  @return a compatible buffered image of the input