code: public static <T extends ImageGray<T>> T convertFromSingle(BufferedImage src, T dst, Class<T> type) {
  		if (type == GrayU8.class) {
  			return (T) convertFrom(src, (GrayU8) dst);
  		} else if( GrayI16.class.isAssignableFrom(type) ) {
  			return (T) convertFrom(src, (GrayI16) dst,(Class)type);
  		} else if (type == GrayF32.class) {
  			return (T) convertFrom(src, (GrayF32) dst);
  		} else {
  			throw new IllegalArgumentException("Unknown type " + type);
  		}
  	}
docs: Converts a buffered image into an image of the specified type.  In a 'dst' image is provided
  it will be used for output, otherwise a new image will be created.