title: How to use ColorQuantizerDescriptor?
body: <p>Following the idea of <a href="https://stackoverflow.com/a/11062157/196844">@PhiLho's answer to How to convert a BufferedImage to 8 bit?</a>, I want to use <code>ColorQuantizerDescriptor</code> to convert a <code>BufferedImage</code>, imageType TYPE_INT_RGB, but <a href="http://docs.oracle.com/cd/E17802_01/products/products/java-media/jai/forDevelopers/jai-apidocs/javax/media/jai/RenderedOp.html#getColorModel()" rel="nofollow noreferrer">RenderedOp#getColorModel()</a> is throwing the following exception:</p>
  
  <pre>
  java.lang.IllegalArgumentException: The specified ColorModel is incompatible with the image SampleModel.
      at javax.media.jai.PlanarImage.setImageLayout(PlanarImage.java:541)
      at javax.media.jai.RenderedOp.createRendering(RenderedOp.java:878)
      at javax.media.jai.RenderedOp.getColorModel(RenderedOp.java:2253)
  </pre>
  
  <p>This is the code that I am attempting to use:</p>
  
  <pre><code>final RenderedOp medianCutQuantizerOp = ColorQuantizerDescriptor.create(rgbImage, ColorQuantizerDescriptor.MEDIANCUT, 256, null, null, null, null, null);
  final BufferedImage bi = medianCutQuantizerOp.getAsBufferedImage(null, medianCutQuantizerOp.getColorModel());
  </code></pre>
  
  <p>How do I use <code>ColorQuantizerDescriptor</code>?</p>