title: How to get ColorSpace of java.awt.Image?
body: <p>I know that when I'm using <code>BufferedImage</code> I can call <code>BufferedImage.getColorModel()</code> 
  but how can I get the same value when I only have an instance of <code>java.awt.Image</code>?</p>
  
  <p>====================================================================================</p>
  
  <p>UPDATED..</p>
  
  <p>OK so . now let me explain extactly what i wanna achieve:</p>
  
  <p>I want to create a method to create some thumbnail of a image.</p>
  
  <p>At first , I convert it to a <code>JPEG</code> file format image and write the result to file,
  And then I found if I do that I will lose the original image's transparency,
  So I'm trying to save the target image as <code>PNG</code> file format and mark the BufferedImage as <code>TYPE_BYTE_INDEXED</code> to reduce the size of target file size, but finally i realized if now the original image itself contains lots of color, then I will get a rough quality target image because <code>TYPE_BYTE_INDEXED</code> can't contains lots color.</p>
  
  <p>SO uh.. now I need to do some research to see if I can get <code>imageType</code> from the <code>Image</code> I got.
  if the <code>imageType</code> is originally <code>TYPE_BYTE_INDEXED</code> then I can use <code>TYPE_BYTE_INDEXED</code> also on the target image , otherwise I can use <code>TYPE_BYTE_ARGB</code> or <code>TYPE_BYTE_RGB</code> (it depends on the origin value of the original image ) to make sure that I will a high quality thumbnail and a smaller size image target file. </p>