docs: private Raster asByteRaster(final Raster raster, ColorModel colorModel) {
          switch (raster.getTransferType()) {
              case DataBuffer.TYPE_BYTE:
                  return raster;
              case DataBuffer.TYPE_USHORT:
                  return raster; // TODO: we handle ushort especially for now..
              case DataBuffer.TYPE_INT:
                  final int bands = colorModel.getNumComponents();
                  final DataBufferInt buffer = (DataBufferInt) raster.getDataBuffer();
  
                  int w = raster.getWidth();
                  int h = raster.getHeight();
                  int size = buffer.getSize();
  
                  return new Raster(
                          new PixelInterleavedSampleModel(DataBuffer.TYPE_BYTE, w, h, bands, w * bands, createBandOffsets(colorModel)),
                          new DataBuffer(DataBuffer.TYPE_BYTE, size * bands) {
                      @Override
                      public int getElem(int bank, int i) {
                          int index = i / bands;
                          int shift = (i % bands) * 8;
  
                          return (buffer.getElem(index) >>> shift) & 0xFF;
                      }
  
                      @Override
                      public void setElem(int bank, int i, int val) {
                          throw new UnsupportedOperationException("Wrapped buffer is read-only");
                      }
                  }, new Point()) {};
              default:
                  throw new IllegalArgumentException(String.format("Raster type %d not supported", raster.getTransferType()));
          }
      }