code: public static void convert(String labelmapBase64, int realWidth, int realHeight, String outPath) {
          try {
  
              byte[] bytes = Base64Util.decode(labelmapBase64);
              InputStream is = new ByteArrayInputStream(bytes);
              BufferedImage image = ImageIO.read(is);
              BufferedImage newImage = resize(image, realWidth, realHeight);
              BufferedImage grayImage = new BufferedImage(realWidth, realHeight, BufferedImage.TYPE_BYTE_GRAY);
              for (int i = 0 ; i < realWidth ; i++) {
                  for (int j = 0 ; j < realHeight; j++) {
                      int rgb = newImage.getRGB(i, j);
                      grayImage.setRGB(i, j, rgb * 255);  // 将像素存入缓冲区
                  }
              }
              File newFile = new File(outPath);
              ImageIO.write(grayImage, "jpg", newFile);
          } catch (IOException e) {
              e.printStackTrace();
          }
      }
docs: 针对人像分割接口，将返回的二值图转化为灰度图,存储为jpg格式
  @param labelmapBase64 人像分割接口返回的二值图base64
  @param realWidth 图片原始宽度
  @param realHeight 图片原始高度
  @param outPath 灰度图输出路径