docs: public static BufferedImage toBuffered(RenderedImage pOriginal) {
          // Don't convert if it already is a BufferedImage
          if (pOriginal instanceof BufferedImage) {
              return (BufferedImage) pOriginal;
          }
          if (pOriginal == null) {
              throw new IllegalArgumentException("original == null");
          }
  
          // Copy properties
          Hashtable<String, Object> properties;
          String[] names = pOriginal.getPropertyNames();
          if (names != null && names.length > 0) {
              properties = new Hashtable<String, Object>(names.length);
  
              for (String name : names) {
                  properties.put(name, pOriginal.getProperty(name));
              }
          }
          else {
              properties = null;
          }
  
          // NOTE: This is a workaround for the broken Batik '*Red' classes, that
          // throw NPE if copyData(null) is used. This may actually be faster too.
          // See RenderedImage#copyData / RenderedImage#getData
          Raster data = pOriginal.getData();
          WritableRaster raster;
          if (data instanceof WritableRaster) {
              raster = (WritableRaster) data;
          }
          else {
              raster = data.createCompatibleWritableRaster();
              raster = pOriginal.copyData(raster);
          }
  
          // Create buffered image
          ColorModel colorModel = pOriginal.getColorModel();
          return new BufferedImage(colorModel, raster,
                                   colorModel.isAlphaPremultiplied(),
                                   properties);
      }