int[] bits = new int[]{8}; int opaque = Transparency.OPAQUE; int dataType = DataBuffer.TYPE_BYTE; ColorModel colorModel = new ComponentColorModel (colorSpace, bits, false, false, opaque, dataType);
    private static RenderedOp grayToGray256 (RenderedOp image)    {        logger.info("Converting gray image to gray-256 ...");        ColorSpace colorSpace = ColorSpace.getInstance            (java.awt.color.ColorSpace.CS_GRAY);        int[] bits = new int[]{8};        int opaque = Transparency.OPAQUE;        int dataType = DataBuffer.TYPE_BYTE;        ColorModel colorModel = new ComponentColorModel            (colorSpace, bits, false, false, opaque, dataType);        return JAI.create("colorConvert", image, colorSpace, null);    }