docs: private static BufferedImage grayToBuffered(MagickImage pImage, boolean pAlpha) throws MagickException {
          Dimension size = pImage.getDimension();
          int length = size.width * size.height;
          int bands = pAlpha ? 2 : 1;
          byte[] pixels = new byte[length * bands];
  
          // TODO: Make a fix for 16 bit TYPE_USHORT_GRAY?!
          // Note: The ordering AI or I corresponds to BufferedImage
          // TYPE_CUSTOM and TYPE_BYTE_GRAY respectively
          pImage.dispatchImage(0, 0, size.width, size.height, pAlpha ? "AI" : "I", pixels);
  
          // Init databuffer with array, to avoid allocation of empty array
          DataBuffer buffer = new DataBufferByte(pixels, pixels.length);
  
          int[] bandOffsets = pAlpha ? new int[] {1, 0} : new int[] {0};
  
          WritableRaster raster =
                  Raster.createInterleavedRaster(buffer, size.width, size.height,
                          size.width * bands, bands, bandOffsets, LOCATION_UPPER_LEFT);
  
          return new BufferedImage(pAlpha ? CM_GRAY_ALPHA : CM_GRAY_OPAQUE, raster, pAlpha, null);
      }