code: public static boolean canWrite (BufferedImage image)
      {
          return (image.getColorModel() instanceof IndexColorModel) &&
              (image.getRaster().getDataBuffer() instanceof DataBufferByte);
      }
docs: Returns true if the supplied image is of a format that is supported by the fast image I/O
  services, false if not.