code: public static BufferedImage grayImage(Object srcIm) {
          BufferedImage srcImage = read(srcIm);
          BufferedImage grayImage = new BufferedImage(srcImage.getWidth(),
                                                      srcImage.getHeight(),
                                                      srcImage.getType());
          for (int i = 0; i < srcImage.getWidth(); i++) {
              for (int j = 0; j < srcImage.getHeight(); j++) {
                  grayImage.setRGB(i, j, Colors.getGray(srcImage, i, j));
              }
          }
          return grayImage;
      }
docs: 获取灰度图像
  
  @param srcIm
  源图片
  @return 灰度图片