title: RenderedImage to BufferedImage for multipage-tiff reading
body: <p>I am using JAI to load in multipage TIFF images</p>
  
  <pre><code>File file = workArea[0];
  SeekableStream s = new FileSeekableStream(file);
  
  TIFFDecodeParam param = null;
  
  ImageDecoder dec = ImageCodec.createImageDecoder("tiff", s, param);
  
  //first page
  RenderedImage op1 =
      new NullOpImage(dec.decodeAsRenderedImage(0),
                      null,
                      OpImage.OP_IO_BOUND,
                      null);
  
  BufferedImage pg1 = new BufferedImage(op1.getWidth(), op1.getHeight(),
                                        BufferedImage.TYPE_INT_RGB);
  pg1.getGraphics().drawImage((Image) op1, 0, 0, null);
  </code></pre>
  
  <p>However, in the last line I get a runtime error of:</p>
  
  <pre><code> Exception in thread "main" java.lang.ClassCastException: 
        javax.media.jai.MullOpImage cannot be cast to java.awt.Image
  </code></pre>
  
  <p>I clear the RenderedImage after attempting to set the BufferedImage so I don't exactly "need" the RenderedImage if there is another method of doing this.</p>
  
  <p>I attempted:</p>
  
  <pre><code> pg1.setData(op1.getData());
  </code></pre>
  
  <p>and that gives an ArrayIndexOutOfBoundsException. I'm not sure why exactly as pg1's width and height are set by op1's, but there is probably a very valid reason.</p>