code: public static BufferedImage toBuffered(RenderedImage pOriginal, int pType) {
          // Don't convert if it already is BufferedImage and correct type
          if ((pOriginal instanceof BufferedImage) && ((BufferedImage) pOriginal).getType() == pType) {
              return (BufferedImage) pOriginal;
          }
          if (pOriginal == null) {
              throw new IllegalArgumentException("original == null");
          }
  
          // Create a buffered image
          BufferedImage image = createBuffered(pOriginal.getWidth(),
                                               pOriginal.getHeight(),
                                               pType, Transparency.TRANSLUCENT);
  
          // Draw the image onto the buffer
          // NOTE: This is faster than doing a raster conversion in most cases
          Graphics2D g = image.createGraphics();
          try {
              g.setComposite(AlphaComposite.Src);
              g.drawRenderedImage(pOriginal, IDENTITY_TRANSFORM);
          }
          finally {
              g.dispose();
          }
  
          return image;
      }
docs: Converts the {@code RenderedImage} to a {@code BufferedImage} of the
  given type.
  <p/>
  If the image is already a {@code BufferedImage} of the given type, it
  is simply returned and no conversion takes place.
  
  @param pOriginal the image to convert.
  @param pType the type of buffered image
  
  @return a {@code BufferedImage}
  
  @throws IllegalArgumentException if {@code pOriginal == null}
  or {@code pType} is not a valid type for {@code BufferedImage}
  
  @see java.awt.image.BufferedImage#getType()