code: public static BufferedImage createCompatibleImage(int width, int height) {
          return isHeadless() ?
                  new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB) :
                  getGraphicsConfiguration().createCompatibleImage(width, height);
      }
docs: <p>Returns a new opaque compatible image of the specified width and
  height. That is, the returned <code>BufferedImage</code> is compatible with
  the graphics hardware. If the method is called in a headless
  environment, then the returned BufferedImage will be compatible with
  the source image.</p>
  
  @see #createCompatibleImage(java.awt.image.BufferedImage)
  @see #createCompatibleImage(java.awt.image.BufferedImage, int, int)
  @see #createCompatibleTranslucentImage(int, int)
  @see #loadCompatibleImage(java.net.URL)
  @see #toCompatibleImage(java.awt.image.BufferedImage)
  @param width the width of the new image
  @param height the height of the new image
  @return a new opaque compatible <code>BufferedImage</code> of the
  specified width and height