docs: public static void writeToStream(BitMatrix matrix, String format, OutputStream stream, MatrixToImageConfig config) 
        throws IOException {  
      BufferedImage image = toBufferedImage(matrix, config);
      if (!ImageIO.write(image, format, stream)) {
        throw new IOException("Could not write an image of format " + format);
      }
    }