code: private BufferedImage convertImage(BufferedImage image)
      {
          if (image.getType() == BufferedImage.TYPE_INT_RGB)
          {
              return image;
          }
          else
          {
              BufferedImage newImage = new BufferedImage(image.getWidth(),
                                                         image.getHeight(),
                                                         BufferedImage.TYPE_INT_RGB);
              newImage.getGraphics().drawImage(image, 0, 0, null);
              return newImage;
          }
      }
docs: Make sure that the image is in the most efficient format for reading from.
  This avoids having to convert pixels every time we access them.
  @param image The image to convert.
  @return The image converted to INT_RGB format.