public final BufferedImage createCompatibleDestImage(BufferedImage pSource, ColorModel pDestCM) {
        if (pDestCM == null) {
            return new BufferedImage(pSource.getWidth(), pSource.getHeight(),
                                     BufferedImage.TYPE_BYTE_INDEXED,
                                     getICM(pSource));
        }
        else if (pDestCM instanceof IndexColorModel) {
            return new BufferedImage(pSource.getWidth(), pSource.getHeight(),
                                     BufferedImage.TYPE_BYTE_INDEXED,
                                     (IndexColorModel) pDestCM);
        }
        else {
            throw new ImageFilterException("Only IndexColorModel allowed.");
        }
    }
public final BufferedImage createCompatibleDestImage ( BufferedImage pSource , ColorModel pDestCM ) { if ( pDestCM == null ) { return new BufferedImage ( pSource . getWidth ( ) , pSource . getHeight ( ) , BufferedImage . TYPE_BYTE_INDEXED , getICM ( pSource ) ) ; } else if ( pDestCM instanceof IndexColorModel ) { return new BufferedImage ( pSource . getWidth ( ) , pSource . getHeight ( ) , BufferedImage . TYPE_BYTE_INDEXED , ( IndexColorModel ) pDestCM ) ; } else { throw new ImageFilterException ( "Only IndexColorModel allowed." ) ; } }
Creates a compatible {@code BufferedImage} to dither into.
Only {@code IndexColorModel} allowed.

@return a compatible {@code BufferedImage}

@throws ImageFilterException if {@code pDestCM} is not {@code null} or
an instance of {@code IndexColorModel}.