docs: protected void setImage(RenderedImage image, Rectangle rect) throws IOException {
          ByteBuffer buff = ImageIOHelper.getImageByteBuffer(image);
          int bpp;
          DataBuffer dbuff = image.getData(new Rectangle(1, 1)).getDataBuffer();
          if (dbuff instanceof DataBufferByte) {
              bpp = image.getColorModel().getPixelSize();
          } else {
              bpp = 8; // BufferedImage.TYPE_BYTE_GRAY image
          }
          setImage(image.getWidth(), image.getHeight(), buff, rect, bpp);
      }