private int[] image2pixels(Image image)
   {
      int ai[] = new int[picsize];
      PixelGrabber pixelgrabber =
              new PixelGrabber(image, 0, 0, width, height, ai, 0, width);
      try
      {
         pixelgrabber.grabPixels();
      }
      catch (InterruptedException interruptedexception)
      {
         interruptedexception.printStackTrace();
      }
      boolean flag = false;
      int k1 = 0;
      do
      {
         if (k1 >= 16)
            break;
         int i = (ai[k1] & 0xff0000) >> 16;
         int k = (ai[k1] & 0xff00) >> 8;
         int i1 = ai[k1] & 0xff;
         if (i != k || k != i1)
         {
            flag = true;
            break;
         }
         k1++;
      } while (true);
      if (flag)
      {
         for (int l1 = 0; l1 < picsize; l1++)
         {
            int j = (ai[l1] & 0xff0000) >> 16;
            int l = (ai[l1] & 0xff00) >> 8;
            int j1 = ai[l1] & 0xff;
            ai[l1] =
                    (int) (0.29799999999999999D * (double) j
                    + 0.58599999999999997D * (double) l
                    + 0.113D * (double) j1);
         }
         
      }
      else
      {
         for (int i2 = 0; i2 < picsize; i2++)
            ai[i2] = ai[i2] & 0xff;
         
      }
      return ai;
   }