public BufferedImage (int width, int height, int imageType, IndexColorModel cm)

Constructs a BufferedImage of one of the predefined image types: TYPE_BYTE_BINARY or TYPE_BYTE_INDEXED.

If the image type is TYPE_BYTE_BINARY, the number of entries in the color model is used to determine whether the image should have 1, 2, or 4 bits per pixel. If the color model has 1 or 2 entries, the image will have 1 bit per pixel. If it has 3 or 4 entries, the image with have 2 bits per pixel. If it has between 5 and 16 entries, the image will have 4 bits per pixel. Otherwise, an IllegalArgumentException will be thrown.

Parameters:
width    width of the created image
height    height of the created image
imageType    type of the created image
cm    IndexColorModel of the created image

Exceptions:
IllegalArgumentException    if the imageType is not TYPE_BYTE_BINARY or TYPE_BYTE_INDEXED or if the imageType is TYPE_BYTE_BINARY and the color map has more than 16 entries.

See also:
TYPE_BYTE_BINARY, TYPE_BYTE_INDEXED